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

Click detector isn't adding this stat after clicking it? [closed]

Asked by
IsPoyo -1
5 years ago

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)

0
Don´t repost your questions. Be patient. DeceptiveCaster 3761 — 5y

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?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Do not use Debounce[player], use Debounce[player.UserId].

0
You should have answered his original question. This one is a duplicate and should not be answered. DeceptiveCaster 3761 — 5y
Ad