I've been making a game and I need a click detector to add to someones stat on click. I want to make it so when you click it you won't ever be able to click it again even if you leave and rejoin. I currently have this script and will you tell me whats wrong and the fixed script? Thanks!
local Debounce = {}
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if Debounce[player] then return end
Debounce[player] = true
local stat = player:WaitForChild(“leaderstats”)[“Kirbies Found”]
stat.Value = stat.Value + 1
end)
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if player:FindFirstChild(“Kirbie”).Value == true then
return
end
player:FindFirstChild(“Kirbie”).Value = true
local stat = player:WaitForChild(“leaderstats”)[“Kirbies Found”]
stat.Value = stat.Value + 1
end)
end)