My goal of this script:
to make an object move when a player touches it (working)
and make the object move back when the player who touched it dies (not working)
game.Workspace.LeaderSeat.Touched:connect(function(player)
wait(0)
script.Parent.Position = Vector3.new(48.019, -8.126, 155.132)
wait(0)
if player.health == 0
then
wait(0)
script.Parent.Position = Vector3.new(48.019, 1.874, 155.132)
wait(0)
end
end)
There is a premade RBXScriptEvent for detecting when a humanoid dies, Humanoid | Roblox Creator Documentation.
Also a .Touched event returns the Part that touched it not the player