I've been asking how to make a part a one time click and even if you leave and come back you can't click it again to get points. I need it to be player specific so other players are still able to click it once. Now, the script isn't adding adding to the players stat (Kirbies Found). If you could tell me whats wrong and tell me how to fix it or show the new script that would be great, 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)
Do not use Debounce[player], use Debounce[player.UserId].
Marked as Duplicate by DeceptiveCaster and theking48989987
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?