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.
Yeah, that kind of stuff annoys me too. A way to get around this is to check in a radius if something is nearby.
local VectorA = Vector3.new(2, 6, 3) local VectorB = Vector3.new(3, 7, 4) local Distance = (VectorA - VectorB).magnitude -- From here you can detect if the distance meets certain requirements if Distance < 5 then -- do stuff end