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

Why don't this simple leader-board script work in a client server?

Asked by 8 years ago
game.Players.PlayerAdded:connect(function(plr)
    local stats = Instance.new("IntValue", plr)
    stats.Name = "leaderstats"
    local Cash = Instance.new("IntValue", stats)
    Cash.Value = 0
    Cash.Name = "Cash"



end)


while true do
    wait(1.5)
        game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 100
        print("Given You 100$")


end


I tried with a localscript/script

and dont work

(Tycoon game)

If you still don't understand im talking about it works in roblox studio but when join as a player not studio mode the leader-board don't show up

1 answer

Log in to vote
0
Answered by 8 years ago

You should just give values for the player. dont do it for every player if your going to use a LocalPlayer. because each localscript that goes into specific services is cloned into each player

    local plr =   game.Players.LocalPlayer  

    local stats = Instance.new("IntValue", plr)
    stats.Name = "leaderstats"

    local Cash = Instance.new("IntValue", stats)
    Cash.Value = 0
    Cash.Name = "Cash"

while true do
    wait(1.5)
        plr.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 100
        print("Given You 100$")


end



Ad

Answer this question