You need to verifie if your variable is false before, for a more nicier version you can you my :)
exemple:
local allow_to_run_the_function_depended_of_this_variable = false
function noLoop()
if not allow_to_run_the_function_depended_of_this_variable then
return
end
allow_to_run_the_function_depended_of_this_variable = true
print('hi')
wait(1)
allow_to_run_the_function_depended_of_this_variable = false
end
script.Parent.Click:connect(noLoop)
It will wait one seconde before you can use it back
theres your code:
local debounce = false
function Click(mouse)
if not debounce then
return
end
debounce = true
game.Players.LocalPlayer.Character.Head.Scream:Play()
wait(2.3)
debounce = false
end
script.Parent.MouseButton1Down:connect(Click)
1 comment
http://wiki.roblox.com/index.php?title=Debounce