Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this click detector script not giving adding a persons stat?

Asked by
IsPoyo -1
5 years ago

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)

0
player:WaitForChild(“leaderstats”).[“Kirbies Found”] danglt 185 — 5y
0
Thanks but it still doesn't add the stat. IsPoyo -1 — 5y
0
Is “Kirbie” just a value of true or false that is in the player but not leaderstats? ABK2017 406 — 5y
0
I was asking how to make the click one time even if you leave and the person said to use that I think its a bool value or something? IsPoyo -1 — 5y

Answer this question