So, I put this code into a part:
part = script.Parent while true do if part.Touched then print("STOP TOUCHING ME!!!!!") end wait() if part.TouchEnded then print("Oh, Finally.") end wait() end
And it started printing infinitely because another part was touching it. Could you know how to help?
Try using the event instead:
01 | part.Touched:Connect( function (hitPart) |
02 | if hitPart.Parent:FindFirstChildOfClass( "Humanoid" ) then |
03 | print ( "STOP TOUCHING ME!!!!!" ) |
04 | end |
05 | end ) |
06 | part.TouchEnded:Connect( function (hitPart) |
07 | if hitPart.Parent:FindFirstChildOfClass( "Humanoid" ) then |
08 | print ( "Oh, Finally." ) |
09 | end |
10 | end ) |