Im trying to make a debounce but it shows the error in the title. Whats the problem
local replicatedStorage = game:GetService("ReplicatedStorage") local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
local cooldown = 1
replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player)
if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end if not remoteData(player.Name).debounce then remoteData(player.Name).debounce.Value = true player.leaderstats.Strength.Value = player.leaderstats.StrengthValue + 25 * (player.leaderstats.Ranks.Value + 1) wait(cooldown) remoteData(player.Name).debounce.Value = false end
end)
There.
if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end if remoteData(player.Name).debounce.Value = false then remoteData(player.Name).debounce.Value = true player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 25 * player.leaderstats.Ranks.Value + 1 wait(cooldown) remoteData(player.Name).debounce.Value = false end
Happy to help, if you have any other questions feel free to add me on Discord: Haunted#5196