Hello!
So, I’m working on a bindable function which would return a player to the stage pad if they fail the obby.
My problem is debounce.
Bindable function is working fine if I remove “if checkDb == nil or checkDb == false then
”
However, I use the same debounce function in a similar script and it works fine there.
What should I do?
Script:
local part = script.Parent
local debounce = {}
local rS = game:GetService("ReplicatedStorage")
local rEvent = game.ReplicatedStorage.Remote.onFailTeleport
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local checkDb = debounce[player.UserId]
if checkDb == nil or checkDb == false then
debounce[player.UserId] = true
rEvent:Fire(game.Players:GetPlayerFromCharacter(hit.Parent))
wait(0.2)
debounce[player.UserId] = false
end
end)