So I'm working on learning the scoreboard system. I'm at the point where I have built a function that creates a leaderstats model and a score intvalue. The problem is this: currently the code is being triggered when the game starts and what I'd rather do is have it be called when a player joins the game. So How do I call a function when a player joins the game?
like
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | local ls = Instance.new( "Folder" ,player) |
03 | ls.Name = "leaderstats" |
04 |
05 | local v 1 = Instance.new( "IntValue" ,ls) |
06 | v 1. Name = "yourvalue1" |
07 |
08 | local v 2 = Instance.new( "IntValue" ,ls) |
09 | v 2. Name = "yourvalue2" |
10 |
11 |
12 | player.CharacterAdded:Connect( function (char) -- This just sets the value |
13 | player.yourvalue 1. Value = 1234 |
14 | player.yourvalue 2. Value = 12345 |
15 |
16 | end ) |
17 | end ) |
?