Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm Trying to make that my items will be saved when i will leave, they are not saving?

Asked by 4 years ago

so i was following this video :https://www.youtube.com/watch?v=HQQOgbkm14A

i did everything but it did not worked

local dataStoreService = game:GetService("DataStoreService") local datastore = dataStoreService:GetDataStore("BackpackSave")

game.Players.PlayerAdded:Connect(function(player) pcall(function() local tool = datastore:GetAsync("User-"..player.UserId) if tool then for i,v in pairs(tool) do local ToolFound = game.ReplicatedStorage.Items:FindFirstChild(v) if ToolFound then ToolFound:Clone().Parent = player.Backpack ToolFound:Clone().Parent = player.StarterGear end end end
end) end)

game.Players.PlayerRemoving:Connect(function(player) pcall(function() local toolsSave = {} for i, tool in pairs(player.Backpack:GetChildren()) do if tool then table.insert(toolsSave,tool.Name) end end datastore:SetAsync("User-"..player.UserId, toolsSave) end) end)

im not asking for a free script, i just wanna know how to make it? my situation is that i made shop where i can buy items, when i buy item it will be added in my inventory but after i rejoin it dissapears i need help sorry for bad english

0
Please use correct formatting when typing code. Here's a link that shows to do that https://scriptinghelpers.org/help/how-post-good-questions-answers. User#27525 1 — 4y
0
sry people, after trying to find mistake for hours i found one, im dumb i forgot to enable studio acess to API services from Basic Settings Sabailuridze 126 — 4y
0
bruh you forgot to enable API? smh rayhansatria 142 — 4y

Answer this question