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

Tool saving script fails to load/save data or clone tools into the backpack. What's wrong? [FIXED]

Asked by 5 years ago
Edited 4 years ago

Script maybe doesn't successfully save data. It loads it in too (Maybe this is where it goes wrong), but the tools do not clone into the backpack. What is the problem?

01local dataStoreService = game:GetService("DataStoreService")
02local toolStore = dataStoreService:GetDataStore("TOOLS")
03--local inventoryStore = dataStoreService:GetDataStore("GuiInventory")
04--local backpackstore = dataStoreService:GetDataStore("Backpack")
05game.Players.PlayerAdded:Connect(function(player)
06    local data = nil
07    local sucess, errormessage = pcall(function()
08        data = toolStore:GetAsync(player.UserId)
09    end)
10    if sucess then
11        if data[#data] then
12            for i,v in pairs(data) do
13                local tool = game:WaitForChild("ReplicatedStorage").Tools:FindFirstChild(data[i])
14                print(tool, data[i])
15                if tool then
View all 41 lines...
0
does something errors? Leamir 3138 — 5y
0
No, no errors R_LabradorRetriever 198 — 5y
0
What does it prints on line 14? Leamir 3138 — 5y
0
lemme see R_LabradorRetriever 198 — 5y
View all comments (4 more)
0
nil R_LabradorRetriever 198 — 5y
0
it's not saving correctly Leamir 3138 — 5y
0
Are you testing on studio or on real game? Depending on your game configuration datastores don't work on Roblox Studio Leamir 3138 — 5y
0
oof, im testing on studio R_LabradorRetriever 198 — 5y

Answer this question