Script not fully executing code in live roblox server

I’m tryna figure out why my scripts is not full running like who it should! In Client Test/Server test everything works smoothly but in a Live Server Test everything just stops
working


This is what the inside of my script looks like it simply creates 2 folders!

I start a test server to see what the inside of player looks like it has 2 folders which is great!

I load a live server and the inventory folder does’t load and only like 50% of the codes loads

I tried to like put different codes in the function to see if some worked and it was 50/50

here is the full script inside of the serverscriptservice everything works fine studio locally and server but oofs in live server!

ServerDataStore = "TestServer5"

game.Players.PlayerRemoving:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name..ServerDataStore)

local statstorage = player:FindFirstChild("ClassFolder"):GetChildren()
for i =  1, #statstorage do
datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
end

end)



game.Players.PlayerAdded:connect(function(player)	
local ClassFolder = Instance.new("Folder", player)
ClassFolder.Name = "ClassFolder"
local Class = Instance.new("StringValue", ClassFolder)
Class.Name = "Class"

local Inventory = Instance.new("Folder", player)
Inventory.Name = "Inventory"

for Number = 1,24,1 do
local Box = Instance.new("StringValue",Inventory)
Box.Name = "Box"..Number
end

local Box1 =  Inventory:FindFirstChild("Box1")
Box1.Value = "Inmate Shirt,Dirty"

local Box2=  Inventory:FindFirstChild("Box2")
Box2.Value = "Inmate Pants,Dirty"

local Box3=  Inventory:FindFirstChild("Box3")
Box3.Value = "AR-10,Dirty"

local Box4=  Inventory:FindFirstChild("Box4")
Box4.Value = "Korsac EM1,Dirty"


local stats = Instance.new("Folder", player)
stats.Name = "Stats"

local Level = Instance.new("NumberValue", stats)
Level.Name = "Level"
Level.Value = 1

-- DataStores below 
local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name..ServerDataStore)

player:WaitForChild("ClassFolder")

local stats = player:FindFirstChild("ClassFolder"):GetChildren()
for i = 1, #stats do			
stats[i].Value = datastore:GetAsync(stats[i].Name)
	end
end)

`

okay so now I found out that my scripts is literally not updating

when i copy it and past it into a new game the codes inside of my scripts are literally different

This is probably something to do with the script collaboration feature. I’m not super familiar with how it works yet, but I’m aware you have to push drafts, or something along those lines. Try figuring that out, or just disabling script collaboration for a moment to test if that fixes it.

You see that ‘Drafts’ tab down in the bottom right? Select all the scripts you’ve changed (by clicking on them), right click, and hit ‘commit’. This will update the serverside scripts. I’m pretty sure there’s an isssue with a Live Server test ATM, for the first few days after the ‘Drafts’ functionality was added it was working perfectly (it would load your ‘drafts’ code, not the code stored online) but something was changed a few days ago and it isn’t working anymore. Once you’ve updated the serverside scripts, it should work OK in live server test. Hope this helps!