script.Parent.Touched:Connect(function()
print("Touched")
end)
✓ ANSWER ACCEPTED
How to prevent it from spamming?
1 answer
✓ Accepted answer
Hello. Use Debounce.
CanPrint = true
script.Parent.Touched:Connect(function()
if CanPrint == true then
CanPrint = false
print("Touched")
script.Parent.BrickColor = BrickColor.new("Really red")
wait(3) --Cooldown
CanPrint = true
script.Parent.BrickColor = BrickColor.new("Lime green")
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Thanks brother.
Why not simply do
if CanPrint theninstead of adding an "== true" into it?