Leaderboard script workspace:
game.Players.PlayerAdded:connect(function(plr)
local f = Instance.new("Folder", plr)
f.Name = "leaderstats"
local coins = Instance.new("IntValue", f)
coins.Name = "Coins"
coins.Value = 0
end)
Coin(button) part workspace: What's wrong with this code? every time I click, I should collect 1p +, but it doesn't work so what changes should this code make to work?
button = script.Parent
local db = true
function onClicked(player)
if workspace:FindFirstChild("Humanoid") then
if db then
db = false
script.Parent.Transparency = 1
local player = game.Players:GetPlayerFromCharacter(onClicked(player))
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 20
wait(1)
script.Parent:Remove()
end
end
end
button.ClickDetector.MouseClick:Connect(onClicked)

3 comments
sorry what do you mean by that? i am sorry i don't understand what you mean?
I put the script, I want to make it work.
ok