01 | game.Players.PlayerAdded:connect( function (plr) |
02 | local stats = Instance.new( "IntValue" , plr) |
03 | stats.Name = "leaderstats" |
04 | local Cash = Instance.new( "IntValue" , stats) |
05 | Cash.Value = 0 |
06 | Cash.Name = "Cash" |
07 |
08 |
09 |
10 | end ) |
11 |
12 |
13 | while true do |
14 | wait( 1.5 ) |
15 | game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 100 |
16 | print ( "Given You 100$" ) |
17 |
18 |
19 | 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
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
01 | local plr = game.Players.LocalPlayer |
02 |
03 | local stats = Instance.new( "IntValue" , plr) |
04 | stats.Name = "leaderstats" |
05 |
06 | local Cash = Instance.new( "IntValue" , stats) |
07 | Cash.Value = 0 |
08 | Cash.Name = "Cash" |
09 |
10 | while true do |
11 | wait( 1.5 ) |
12 | plr.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 100 |
13 | print ( "Given You 100$" ) |
14 |
15 |
16 | end |