Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Anti-Tool Script Help?

Asked by 9 years ago

The tool called 'tool' even if it isn't equipped and I sit down on the seat, i still die. I need it to only kill when the tool is equipped. Help please? No output btw.

local seat = script.Parent function onChildAdded(child) local user = child.part1.Parent if (child.Name == "SeatWeld") or user:FindFirstChild(Tool).Equipped then user.Head:remove() end end script.Parent.ChildAdded:connect(onChildAdded)

1 answer

Log in to vote
0
Answered by 9 years ago

Well, you look for something named "part1" inside of the seatweld that enters the seat, but it the property is actually named "Part1". Also, you are just finding the parent of a Property, which returns a nil value.

I'm not sure if this will work, but try replacing your user variable with this: local user = game.Players[child.Part1.Value].Character

Ad

Answer this question