local currencyName = "Credits"
local killName = "Kills"
local DataStore = game:GetService("DataStoreService"):GetDataStore("Datastore")
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder")
folder.Name = "leaderstats"
folder.Parent = player
local currency = Instance.new("IntValue")
currency.Name = currencyName
currency.Parent = folder
local kill = Instance.new("IntValue")
kill.Name = killName
kill.Parent = folder
local ID = currencyName.."-"..player.UserId
local ID = killName.."-"..player.UserId
local savedData = nil
pcall(function()
savedData = DataStore:GetAsync (ID)
end)
if savedData ~= nil then
currency.Value = savedData
kill.Value = savedData
print("Data loaded")
else
currency.Value = 1000
kill.Value = 0
print("New player to the game")
end
end)
this is my whole script but the script I'm having trouble is this one.
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder")
folder.Name = "leaderstats"
folder.Parent = player
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.

10 comments
Try printing the name of folder after you make it. It could be you are looking in the wrong place for leaderstats.
Also you don’t have to say ~= nil. You can just say the variable. If the variable isn’t nil it will do what’s in the if statement. Just saves time lol
I tried searching the leaderstats folder in my explorer. But it doesn't exist like my problem script don't work.
print(folder.Name) and see if it prints leaderstats.
Or say if player:FindFirstChild(“leaderstats”) then print(“hi”) end If leaderstats is in player it will print hi. Are you getting an error in output?
not working I decided to make another file and try to use the script. It works! So I just need to copy all my files to a new game.
That’s odd. If it still doesn’t work check the output. It could be a script causing it to crash.
eromusics it seems to me that you aren't showing the full script. on line 44 I see an extra end. Is there any part of the script that is a yielding function? ex: WaitForChild().
oh didnt click read extra comments xD sorry
By the way there is no errors about the script in the output. If there is any errors I should already know what is the problem. I suspect an item or script is making my script not working at somepoint.