Yes I’ve made debounces before and Im not sure why this one won’t work.
Simple stuff you click the button its supposed to call the function, but only 1 time, until the cooldown finishes then you will be able to click again!
plrsGui.speechFrame.speech.MouseButton1Up:Connect(function()
if not deb2 then
deb2 = true
print("Clicked")
--scroll()
wait(2)
deb2 = false
end
end)
Where is the variable deb2 stated in the script? if it’s like this:
plrsGui.speechFrame.speech.MouseButton1Up:Connect(function()
local deb2 = false
if not deb2 then
deb2 = true
print("Clicked")
--scroll()
wait(2)
deb2 = false
end
end)
then it wont work, stating it like this however:
local deb2 = false
plrsGui.speechFrame.speech.MouseButton1Up:Connect(function()
if not deb2 then
deb2 = true
print("Clicked")
--scroll()
wait(2)
deb2 = false
end
end)
that should work, Otherwise, I have no clue why it isn’t functioning properly.
It would then get stuck running once since it never sets deb2 to false again, and he wants it to run multiple times, with a wait time each run.
EDIT: NEVERMIND! read it wrong, sorry! You’re correct, I thought he wanted it to run as many times as possible!
No my bad @TheBigC10 you are correct I don’t want it to get stuck I just want it to only fire once at a time sorry, poor choice of words from me. Also deb2 is declared outside of the clicked function
That’d odd, I don’t know why it isn’t working then, The script I supplied should work, Could you send the full script? (If it isn’t the whole thing already)
Well the whole thing has a ton of irrelevant things but I’ll give what you need, there is a touched event on a part in the workspace, get the player using the hit and stuff, the plrsGui variable is refrence to player.PlayerGui
It makes the speechFrame inside of the plrsGui visible then sets up the click event on the text button inside of the speechFrame