Why is my folder leaderstats is not showing at my player when I run the game?
01 | local currencyName = "Credits" |
03 | local killName = "Kills" |
05 | local DataStore = game:GetService( "DataStoreService" ):GetDataStore( "Datastore" ) |
09 | game.Players.PlayerAdded:Connect( function (player) |
11 | local folder = Instance.new( "Folder" ) |
12 | folder.Name = "leaderstats" |
13 | folder.Parent = player |
17 | local currency = Instance.new( "IntValue" ) |
18 | currency.Name = currencyName |
19 | currency.Parent = folder |
21 | local kill = Instance.new( "IntValue" ) |
25 | local ID = currencyName.. "-" ..player.UserId |
26 | local ID = killName.. "-" ..player.UserId |
30 | savedData = DataStore:GetAsync (ID) |
33 | if savedData ~ = nil then |
34 | currency.Value = savedData |
35 | kill.Value = savedData |
40 | print ( "New player to the game" ) |
this is my whole script
but the script I'm having trouble is this one.
1 | game.Players.PlayerAdded:Connect( function (player) |
3 | local folder = Instance.new( "Folder" ) |
4 | folder.Name = "leaderstats" |
I'm sure this is correct. But why does it not show? I use a normal script in serverscriptservice. There is no other script that block this.