Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Leaderboard coin giver brick is not adding coins to the leaderboard, why not?

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?

1 answer

✓ Accepted answer

You put player.leaderstats.Coins.Value = player.leaderstats.Money.Value +5 (Money instead of coins)

player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +5

1 comment

0

Oh, I didn't see that, haha thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.