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

Tool saving script only loaded tools once? [FIXED]

Asked by
Jac_00b 157
4 years ago
Edited 4 years ago

So, I followed a yt tutorial on how to make a tool saving script. The first time I tried loading the tools it worked normally, but the 2nd time I played the game the script broke. Does anybody know how to fix this? Here's the script:

01local dss = game:GetService("DataStoreService")
02local toolsDS = dss:GetDataStore("ToolsData")
03 
04local toolsFolder = game.ServerStorage.ToolsFolder
05 
06game.Players.PlayerAdded:Connect(function(plr)
07 
08    local toolsSaved = toolsDS:GetAsync(plr.UserId .. "-tools") or {}
09 
10    for i, toolSaved in pairs(toolsSaved) do
11 
12        if toolsFolder:FindFirstChild(toolSaved) then
13 
14            toolsFolder[toolSaved]:Clone().Parent = plr.Backpack
15            toolsFolder[toolSaved]:Clone().Parent = plr.StarterGear
View all 62 lines...

Also, I would like to address some common questions you may ask: 1. API Services are enabled. 2. I tested it both in studio and in the real game. 3. There are no errors in the output. 4. I can tell the problem is with loading the tools because when I stop the game in the output it says "DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 178628425-tools", meaning that it saved properly.

So if anybody could help I would really appreciate it!

0
UPDATE: If you have 2 tools in your inventory, 1 of them will save Jac_00b 157 — 4y
0
Update 2: Its keeping only 1 item saved, not any others though Jac_00b 157 — 4y
0
It randomly started working. Jac_00b 157 — 4y
0
...And it stopped working again. oof Jac_00b 157 — 4y

1 answer

Log in to vote
0
Answered by
Jac_00b 157
4 years ago

So, it turns out if you clone the tool from workspace, it doesn't work. If you clone the tool from the tools folder, the autosave feature works.

Ad

Answer this question