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)
I May Have Your Answer I Made A YouTube Video On How To Do It If You Have Any Problems Comment On The Video Or Tell Me Here (Scripting Helpers).
Link To Video: https://youtu.be/f4bPwMEzIoE/