So, I have a script that gets the value of an int value, and runs code depending on what the value is (for rn it just prints what the value is) anyways, I added a debounce the debounce is set to false at first (needs to be set to false for code to run) then set to true, then back to false. well, whenever debounce is set to false, I made it print("debounce is false"), and same for when its set to true. anyways, whenever I touch the brick (this is all inside a function btw), it does, as it should, print debounce is true, waits 20 seconds, then prints debounce is false but on the second go-around that you touch the part, it prints debounce is false, and never prints debounce is true and I have no clue why any help would be appreciated PLEASE DO NOT SPOON FEED ME.
debounce = false
game.ReplicatedStorage.GetPowerup.OnServerEvent:connect(function(plr)
if debounce == false then
debounce = true
print("debounce true")
if script.Parent.tier.Value == 1 then
print("One")
elseif script.Parent.tier.Value == 2 then
print("Two")
elseif script.Parent.tier.Value == 3 then
print("Three")
elseif script.Parent.tier.Value == 4 then
print("Four")
elseif script.Parent.tier.Value == 5 then
print("Five")
end
end
end)
wait(20)
print("debounce is false")
debounce = false

1 comment
Can you show the whole code including the function?