I tried asking others on various developer discord groups and had no answers to this.
I’m hoping it is an easy fix so I don’t have to provide more but the mean problem is the active being false and the button still clicking and the function is working.
If anyone knows why I will be grateful, thank you.
To support what @NPh_rd says, you likely need a debounce in this case, as it allows you to implement code that runs completely before it is called to run again.
local Debounce = false
Button.MouseButton1Click:Connect(function()
if Debounce then
print("Code is currently running. Try again later!")
return
end
Debounce = true
-- your code here
Debounce = false
print("Finished!")
end)
Yeah, you can add an else statement if you want but either way it would work still because when the button clicks it will check if debounce is false then sets debounce to true and actual code runs.
But add an else statement, I would add the else statement as well and that is why it exists.