|
| 21 Nov 2011 07:09 PM |
Supposed to give a tool, but didn't. Tell me what's wrong and what to put in, please.
function onChildAdded(child) if child.Name == "SeatWeld" then if child.Part1.Name == "Torso" then player = game.Players:GetPlayerFromCharacter(child.Part1.Parent) if player ~= nil then tool = game.Lighting.Gun:Clone() tool.Parent = player.Backpack end end end end
function onChildRemoved() if tool ~= nil then tool:Remove() end end
script.Parent.ChildAdded:connect(onChildAdded) script.Parent.ChildRemoved:connect(onChildRemoved)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Nov 2011 07:34 PM |
Untested:
local seat = script.Parent local tool = game.Lighting:FindFirstChild("Gun"):Clone() local Players = game.Players
seat.ChildAdded:connect(function(child) if child.Name == 'SeatWeld' and child:IsA 'Weld' and child.Part0 == seat and child.Part1:IsA 'Part' and child.Part1.Name == "Torso" then local player = Players:GetPlayerFromCharacter(child.Parent) if player and player:FindFirstChild 'Backpack' then tool:Clone().Parent = player.Backpack end end end)
seat.ChildRemoved:connect(function(child) if child.Name == 'SeatWeld' and child:IsA 'Weld' and child.Part0 == seat and child.Part1:IsA 'Part' and child.Part1.Name == "Torso" then local player = Players:GetPlayerFromCharacter(child.Parent) if player and player:FindFirstChild 'Backpack' and player.Backpack:FindFirstChild "Gun" then player.Backpack.Gun:Remove() end end end) |
|
|
| Report Abuse |
|
|
|
| 21 Nov 2011 08:02 PM |
@Julien,
I can't sit down with that script. |
|
|
| Report Abuse |
|
|
|
| 21 Nov 2011 08:04 PM |
"Siddown".
"I can't sit down with that script."
Yep, average intelligence of someone in a warclan.
BTW, read the sticky. http://www.roblox.com/Forum/ShowPost.aspx?PostID=9772680 |
|
|
| Report Abuse |
|
|
|
| 21 Nov 2011 08:11 PM |
XD
And I've read that sticky. |
|
|
| Report Abuse |
|
|