01 | local function onPlayerJoin(player) |
02 | local leaderstats = Instance.new( "Folder" ) |
03 | leaderstats.Name = "Leaderstats" |
04 | leaderstats.Parent = player |
05 |
06 | local points = Instance.new( "IntValue" ) |
07 | points.Name = "Points" |
08 | points.Parent = leaderstats |
09 | points.Value = 0 |
10 | end |
11 |
12 | game.Players.PlayerAdded:Connect(onPlayerJoin) |
Use remote event.
Script 1
1 | Example = 0 |
2 | RemoteEvent:fireserver(Example) |
Script 2
1 | RemoteEvent.onServerEvent:connect( function (Example) |
2 | Point = Example |
You have to navigate to it in that other script.
1 | player.leaderstats.Points.Value = player.leaderstats.Points.Value+ 10 |
Of course you would have to figure out the best way to set player.
If you are in a localscript you could use
1 | player = game.Players.LocalPlayer |
But you would only be able to read from there, in which you would use remoteevents to change it from the server.
some events return player too such as the event your using for onPlayerJoin.