I am trying to change a value after the player touches a part and immediately move the part away from the player to prevent the player from triggering the script multiple times. This does move the part in time, some times but most of the time the player ends up touching the part and triggering the script multiple times anyways. Any suggestions?
Here is my code:
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
script.Parent.Position = Vector3.new(-12.15, 621.894, 47.98)
print("test")
end
script.Parent.Touched:connect(onTouched)
"test" is being printed multiple times when the part is touched.

4 comments
oh
brb test it
Understood the note, I'll do that next time.
tyvm