i have made a data store but it doesnt save anything and im not getting any errors which is annoying as hell
here is the script, i give up. any help very appreciated
> game.Players.PlayerRemoving:Connect(function(plr)
> local invbar = plr.PlayerGui.InvBar
> local itemstable = {}
> local foundtool1 = false
> local foundtool2 = false
> local foundtool3 = false
> for i,v in pairs(invbar.Pickaxe.bg1.ToolImage:GetChildren()) do
> if v:IsA("Tool") then
> table.insert(itemstable,v.Name)
> foundtool1 = true
> end
> end
> if foundtool1 == false then
> table.insert(itemstable,"Empty")
> end
> for i,v in pairs(invbar.Accessory.bg2.ToolImage:GetChildren()) do
> if v:IsA("Tool") then
> table.insert(itemstable,v.Name)
> foundtool2 = true
> end
> end
> if foundtool2 == false then
> table.insert(itemstable,"Empty")
> end
> for i,v in pairs(invbar.Special.bg3.ToolImage:GetChildren()) do
> if v:IsA("Tool") then
> table.insert(itemstable,v.Name)
> foundtool3 = true
> end
> end
> if foundtool3 == false then
> table.insert(itemstable,"Empty")
> end
> local sukces2,blad2 = pcall(function()
> invdatastore:SetAsync(plr.UserId,itemstable)
> end)
> if sukces2 then
> print("udao sie")
> else
> print("cos sie nie udao")
> warn(blad2)
> end
> end)
try it in a roblox server instead of in roblox studio. Datastores and textfiltering don’t work in roblox studio to prevent a user from making a script outside of roblox’s boundaries that still affects their servers.
pretty sure roblox can’t save objects. you’ll need to give them an ID, save the IDs and then them load them in using those IDs from the server.
(ObjectIDs in the datastore)>(Server takes those IDs)>(Server gives the correct objects)
oh yea… my bad.
Are you calling this from the server or the client? you cannot use PlayerRemoving on the client because the localscript would not be running at that point anymore. Also, i’m not seeing anything in that script that would access the datastore to get the names and use them.
are you using an alt account to view what happens on the server side?|
I too am as confused as you probably are. you might wanna contact roblox with this.
This is wrong. table.insert does not work like that. If there is no 3rd argument, the 2nd argument is read as the data and it is appended. If you have 3 arguments the 3rd argument is the data and the 2nd is the index.