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

Why does this not work?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I have tried shifting things around but it does still not work.

Thanks for people helping me in advance to anybody that does.

-- Function for adding players
function playerAdded(player)
    player.TeamColor = BrickColor.new(1)
    local leaderstats = Instance.new("Model")
    leaderstats.Name = 'leaderstats'

    local points = Instance.new("IntValue")
    points.Name = "Ch-Ching"
    points.Parent = leaderstats

    leaderstats.Parent = player

    player.CharacterAdded:connect(function(character)
        newcharacter(player, character)
    end)
    if player.Character and player.Character.Parent then
        newcharacter(player, player.Character)

    end





end
-- Event for handling that function
game.Players.PlayerAdded:connect(playerAdded)
for _, player in pairs(game.Players:GetPlayers()) do
    playerAdded(player)

1 answer

Log in to vote
0
Answered by 9 years ago
-- just a little example
-- by test1097

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

while wait(3) do
    for _, player in pairs (game.Players:GetChildren())do
        player.leaderstats.points.Value = player.leaderstats.points.Value +1
    end
end
Ad

Answer this question