I am making a tycoon with a leaderboard for cash.
01 | -- leaderboard made by roboy5857 |
02 |
03 | function onPlayerEntered(newPlayer) |
04 | local stats = Instance.new( "IntValue" ) |
05 | stats.Name = "leaderstats" |
06 |
07 | local Moneyz = Instance.new( "IntValue" ) |
08 | Moneyz.Name = "Moneyzz" |
09 | Moneyz.Value = 5 |
10 |
11 | Moneyz.Parent = stats |
12 | end |
It won't work, why?
Try this instead.
01 | function onPlayerEntered(newPlayer) |
02 |
03 | local stats = Instance.new( "IntValue" ) |
04 | stats.Name = "leaderstats" |
05 |
06 | local cash = Instance.new( "IntValue" ) |
07 | cash.Name = "Moneyzz" |
08 | cash.Value = 5 |
09 |
10 | cash.Parent = stats |
11 | stats.Parent = newPlayer |
12 | end |
13 |
14 |
15 |
16 | game.Players.ChildAdded:connect(onPlayerEntered) |
17 | --You forgot to connect the function like this above |
Please note: That if you don't connect a function it's pretty much useless and it wouldn't work.