I have a one time stat adder and I want to make that one time stat change save over when you leave. So basically when you leave you still cant click the object again for another stat gain.
Here is my script so far: 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)
Thanks to anyone who helps!
"I have a one time stat adder and I want to make that one time stat change save over when you leave. So basically when you leave you still cant click the object again for another stat gain.
Here is my script so far:
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)
Thanks to anyone who helps!"
Well I saw your earlier post and uh... someone told you but you didn't fully understand what he said. if you have a datastore you might just wanna add a Check in there called "Kirbie" and make it's class a Bool Value
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)
Would be a way I would do it. However, I'm not a professional on debounce so sorry if this is not the solution you are looking for.