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

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

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

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



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