Hi, I'm having a problem with this code.
I'm testing on saving parts using Data Stores, but when I start a server and start a new player into the server, the output returns an error that I believe has been already fixed.
This picture is what the output returned.
This picture displays the hierarchy of the Explorer.
Note: There is just a bunch of parts inside the model that is inside the ServerStorage.
Do you know the solution to fix the error?
StructureStore = game:GetService("DataStoreService"):GetDataStore("StructureStore") local structure = game:GetService("ServerStorage"):FindFirstChild("Structure_Player") function PlayerEntered(player) local key = "Structure_"..player.Name repeat wait() until player.Character if StructureStore:GetAsync(key) ~= nil then StructureStore:GetAsync(key).Parent = game.Workspace else local structure_clone = structure:clone() structure_clone.Parent = game.Workspace structure_clone.Name = "Structure_"..player.Name end end function PlayerLeaving(plr) local key = "Structure_"..plr.Name StructureStore:SetAsync(key, game.Workspace["Structure_"..plr.Name]) end game.Players.PlayerAdded:connect(PlayerEntered) game.Players.PlayerRemoving:connect(PlayerLeaving)
Considering what the output says, the problem comes from the fact your StructureStore
value is empty, wich means that game:GetService("DataStoreService"):GetDataStore("StructureStore")
returned nil. My deduction is that your script simply failed at creating a data store. Did you try to launch your script in online mode ? (Sometimes, data stores can't be created while in test mode)