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

This script spams my print command but I don't know how to stop it?

I've made a script for a part, and when you click the part, it does this: Hit.Name.. but this spams it until I get off the part, how do I make it stop

local Part = game.Workspace.Part
Part.Touched:Connect(function(Hit)
	print(Hit.Name.." touched")
end)

1 answer

✓ Accepted answer

You will need a debounce/cooldown, this works by setting the cooldown to false (it's a boolean) , when the touched event triggers, add an if statement checking if the cooldown is false, and if it is false, set the cooldown to true and then run the code needed, then you can make it wait a specific amount of time and set it back to false

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