I don't know what the problem is, but here is the leaderboard script:
game.Players.PlayerAdded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' local coins = Instance.new('IntValue', stats) coins.Name = 'Coins' coins.Value = 0 local diamonds = Instance.new('IntValue', stats) diamonds.Name = 'Diamonds' diamonds.Value = 0 local wins = Instance.new('IntValue', stats) wins.Name = 'Wins' wins.Value = 0 local exp = Instance.new('IntValue', stats) exp.Name = 'Exp' exp.Value = 0 local level = Instance.new('IntValue', stats) level.Name = 'Level' level.Value = 0 end)
And then here is the Part that i inserted the script into to give coins onto the leaderboard:
local brick = script.Parent function onTouched(hit) for i,player in ipairs(game.Players:GetPlayers()) do if player.Character then local stat = player:FindFirstChild("leaderstats") if stat then player.leaderstats.Coins.Value = player.leaderstats.Money.Value +5 brick:Destroy() end end end end brick.Touched:connect(onTouched)
Does anyone know what the problem may be?
You put player.leaderstats.Coins.Value = player.leaderstats.Money.Value +5 (Money instead of coins)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +5