I created the following script:
script.Parent.Transparency = 1
script.Parent.CanCollide = true
function touch(plr)
print("touched")
wait(0.5)
script.Parent.CanCollide = false
end
script.Parent.Touched:connect(touch)
I want to revert the CanCollide property for the parent back to true, but only when the player is no longer touching the parent. How can I do this? Apparently, the game identifies the player as no longer touching when they are not moving (even though they are still touching).
I tried adding the TouchEnded event, and all it does is infinitely switch the CanCollide property between true and false at a fast pace.

1 comment
Use a boolean value. When the part is being touched, set the boolean to true, and when the part has left collision with the player then set it to false.