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)
`