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

How do i stop the script if the part is not touched anymore?

Asked by 8 years ago
local partFind = game.Workspace
game.Workspace.barricade1remove.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
wait(3)
partFind.BarA:Remove()
wait(3)
partFind.BarB:Remove()
wait(3)
partFind.BarC:Remove()
wait(3)
partFind.BarD:Remove()
wait(3)
partFind.BarE:Remove()
partFind.Wall:Remove()
end
end)

1 answer

Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
8 years ago

Use the TouchEnded event and compare what has stopped touching it to what was touching it and see if they are the same object or child of said object.

Ad

Answer this question