Yes, I do have API access enabled.
1 | local DSS = game:GetService( "DataStoreService" ) |
2 | local leveldatastore = DSS:GetDataStore( "LevelNumber" ) |
3 |
4 | game.Players.PlayerAdded:connect( function (player) |
5 | local level = Instance.new( "NumberValue" ,player) |
6 | level.Name = "level" |
7 | level.Value = leveldatastore:GetAsync(player.UserId) or 1 |
8 | leveldatastore:SetAsync(player.UserId,level.Value) |
9 | end ) |
01 | local DSS = game:GetService( "DataStoreService" ) |
02 | local leveldatastore = DSS:GetDataStore( "LevelNumber" ) |
03 | game.Players.PlayerAdded:connect( function (player) |
04 | local PlayerStats = leveldatastore:GetAsync(game.Players [ player.Name ] .UserId) |
05 | if not PlayerStats then |
06 | PlayerStats = 1 |
07 | leveldatastore:SetAsync(game.Players [ player.Name ] .UserId, PlayerStats) |
08 | end |
09 | local level = Instance.new( "IntValue" ) |
10 | level.Name = "level" |
11 | level.Value = PlayerStats |
12 | level.Parent = game.Players [ player.Name ] |
13 | end ) |