So this script is supposed to make a vehicle's Parent be your character, and if you die, it will break the vehicle and remove it.
The script makes you the parent of the vehicle, but it won't break or get removed after you die. Can someone please help me?
Here's the script:
function onDie()
human = nil
script.Parent.Parent:BreakJoints()
wait(3)
script.Parent.Parent:remove()
end
function Child(c)
if c.Name == "SeatWeld" and c.Part1.Name == "Torso" then
human = c.Part1.Parent
script.Parent.Parent.Parent = human
human.Humanoid.Died:connect(onDie)
end
end
function noChild()
human = nil
script.Parent.Parent.Parent = game.Workspace
end
script.Parent.ChildAdded:connect(Child)
script.Parent.ChildRemoved:connect(noChild)

2 comments
Is a local script needed for this to work?
No, it can be used in a normal script :)