Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Money Leaderboard Help? [SOLVED]

Asked by 8 years ago
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

Log in to vote
-1
Answered by 8 years ago
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 :)

0
If you solved your own question, then delete the question. NinjoOnline 1146 — 8y
Ad
Log in to vote
-3
Answered by 8 years ago
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

0
Ok I think I see it is it supposed to be pairs not ipairs um johndeer2233 439 — 8y
0
... What? earthlypyromancer101 0 — 8y
0
line 14 for _, player in pairs you wrote in ipairs johndeer2233 439 — 8y
0
What was the devote for johndeer2233 439 — 8y

Answer this question