Cjslick
|
  |
| Joined: 11 Jul 2009 |
| Total Posts: 2130 |
|
|
| 21 Jan 2014 05:29 PM |
Hey guys, I have a problem with my tool giving seat, where the tool stays in the inventory if you use the tool. The problem Is I have no idea if i need to make a separate script or tweak the script I already have.
Could someone shed some light on what I would need to do and help me? Of course any help is appreciated. |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2014 05:37 PM |
| Is the tool a tool or a hopperbin? Can we see the seat's script? |
|
|
| Report Abuse |
|
|
Cjslick
|
  |
| Joined: 11 Jul 2009 |
| Total Posts: 2130 |
|
|
| 21 Jan 2014 06:48 PM |
Tool. (I would have said hopperbin if it was)
Sure thing: ---- position = script.Parent.Position seat = script.Parent
function onSitUp(child, gui, plane) if child.Parent == nil then gui.Parent = script gui.rmv.Disabled=true gui.RadarScript.Disabled=true script.Parent.Locked = false script.Parent.Parent = game.Workspace end end
function onChildAdded(part) if part.className == "Weld" then local torso = part.Part1 if torso ~= nil then
local char = torso.Parent local player = game.Players:GetPlayerFromCharacter(char) if player ~= nil then local GUI = game.Lighting.Turret:clone() GUI.Parent = player.Backpack part.AncestryChanged:connect(function(child) onSitUp(child, GUI, script.Parent) end) end local parent = torso.Parent if parent ~= nil then script.Parent.Locked = true script.Parent.Parent = parent end end end end
seat.ChildAdded:connect(onChildAdded) ---- |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2014 06:58 PM |
This is just a test, I know a different way but the one you had seems fine...
position = script.Parent.Position seat = script.Parent
function onSitUp(child, gui, plane, part) wait() if child.Parent == nil or part == child then gui:Destroy() script.Parent.Locked = false script.Parent.Parent = game.Workspace end end
function onChildAdded(part) if part.className == "Weld" then local torso = part.Part1 if torso ~= nil then
local char = torso.Parent local player = game.Players:GetPlayerFromCharacter(char) if player ~= nil then local GUI = game.Lighting.Turret:clone() GUI.Parent = player.Backpack part.AncestryChanged:connect(function(child) onSitUp(child, GUI, script.Parent, part) end) end local parent = torso.Parent if parent ~= nil then script.Parent.Locked = true script.Parent.Parent = parent end end end end
seat.ChildAdded:connect(onChildAdded) |
|
|
| Report Abuse |
|
|
Cjslick
|
  |
| Joined: 11 Jul 2009 |
| Total Posts: 2130 |
|
|
| 21 Jan 2014 07:01 PM |
| I just realized there's a GUI part, I don't have a GUI to assign. Will that be the glitching part? |
|
|
| Report Abuse |
|
|
Cjslick
|
  |
| Joined: 11 Jul 2009 |
| Total Posts: 2130 |
|
|
| 21 Jan 2014 07:06 PM |
| It gives the tool but immediately takes it away. |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2014 07:11 PM |
lol I thought it would do that, sorry: (btw, the "gui" is actually the tool, I don't know why its called gui in this case)
position = script.Parent.Position seat = script.Parent
function onSitUp(child, gui, plane, part) wait() if child.Parent == nil and part == child then gui:Destroy() script.Parent.Locked = false script.Parent.Parent = game.Workspace end end
function onChildAdded(part) if part.className == "Weld" then local torso = part.Part1 if torso ~= nil then
local char = torso.Parent local player = game.Players:GetPlayerFromCharacter(char) if player ~= nil then local GUI = game.Lighting.Turret:clone() GUI.Parent = player.Backpack part.AncestryChanged:connect(function(child) onSitUp(child, GUI, script.Parent, part) end) end local parent = torso.Parent if parent ~= nil then script.Parent.Locked = true script.Parent.Parent = parent end end end end
seat.ChildAdded:connect(onChildAdded) |
|
|
| Report Abuse |
|
|
Cjslick
|
  |
| Joined: 11 Jul 2009 |
| Total Posts: 2130 |
|
|
| 22 Jan 2014 07:30 AM |
Oh. I think the reason for that Is I didn't want to mess with changing the variables, because of the sheer number of times it's stated in this script.
Works great now, just one question about what you altered from the original script. |
|
|
| Report Abuse |
|
|