Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.