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

Money Leaderboard Help? [SOLVED]

game.Players.PlayerAdded:connect(function(player)
	local leaderstats = Instance.new("Model")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local money = Instance.new("IntValue")
	money.Name = "Money"
	money.Value = 250
	money.Parent = leaderstats
end)

if player.TeamColor == BrickColor.new("Burnt Sienna") then
	while wait(5) do
		for _, player in ipairs(game.Players:GetPlayers()) do
			if player:FindFirstChild("leaderstats") then
				player.leaderstats.Money.Value = player.leaderstats.Money.Value + 1
			end
		end
	end
end

The problem is in the "if player.TeamColor =..." part, I know to identify what exactly "player" is, but I don't know what to identify it as. Should it be "player = game.Players" or what?

Edit #1:Actually, I don't even know if the bottom part will work at all even with "player" identified, all help is appreciated.

2 answers

game.Players.PlayerAdded:connect(function(player)
    local leaderstats = Instance.new("Model")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local money = Instance.new("IntValue")
    money.Name = "Money"
    money.Value = 250
    money.Parent = leaderstats

while wait(5) do
	if player.TeamColor == BrickColor.new("Burnt Sienna") then
            if player:FindFirstChild("leaderstats") then
                money.Value = money.Value + 1
            end
        end
end
end)

Solved my own problem :)

1 comment

0

If you solved your own question, then delete the question.

function onPlayerEntered(newPlayer) 
	wait(.5) 
	local stats = Instance.new("IntValue") 
	stats.Name = "leaderstats"
	local Money = Instance.new("IntValue")
	Money.Name = "Money" 
	Money.Value = 500	

	Money.Parent = stats 
	stats.Parent = newPlayer 
end 

game.Players.ChildAdded:connect(onPlayerEntered) 

This will work but Ill check over yours and see the problem

4 comments

0

Ok I think I see it is it supposed to be pairs not ipairs um

0

... What?

0

line 14 for _, player in pairs you wrote in ipairs

0

What was the devote for

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