Hi guys! I been making a save script but then I got this error; 14:44:56.063 - ServerScriptService.SaveScript2:9: bad argument #3 to 'Value' (string expected, got nil)
This is the output: 14:44:56.063 - ServerScriptService.SaveScript2:9: bad argument #3 to 'Value' (string expected, got nil) 14:44:56.064 - Stack Begin 14:44:56.066 - Script 'ServerScriptService.SaveScript2', Line 9 14:44:56.067 - Stack End
So this is the error: 14:44:56.063 - ServerScriptService.SaveScript2:9: bad argument #3 to 'Value' (string expected, got nil)
I put the code inside a script and the script's parent is ServerScriptService, which means the script is inside the ServerScriptService, should I move it? Should I change anything?
This is the code inside the script;
local DataStore = game:GetService("DataStoreService"):GetDataStore("Slot1Taken")
local DataStore2 = game:GetService("DataStoreService"):GetDataStore("CurrentImage")
local DataStore3 = game:GetService("DataStoreService"):GetDataStore("NumberAmount")
game.Players.PlayerAdded:connect(function(plr)
local PlayerKey = "user_" .. plr.userId
local slot1taken = plr:WaitForChild("Slot1Taken")
slot1taken.Value = DataStore:GetAsync(PlayerKey)
local slot1currentimage = plr.PlayerGui.MenuGui.InventoryMain.InventoryFrame.InventoryBackground.ElementSlot1.ElementImage:WaitForChild("CurrentImage")
slot1currentimage.Value = DataStore2:GetAsync(PlayerKey)
local slot1amount = plr.PlayerGui.MenuGui.InventoryMain.InventoryFrame.InventoryBackground.ElementSlot1.ElementImage.Amount:WaitForChild("NumberAmount")
slot1amount.Value = DataStore3:GetAsync(PlayerKey)
end)
Tell me how to fix it and if you have time please debug it and change the script so it works, I need explaining, also tell me if I need to move anything or change anything. This is a save script to save stuff. Please help!
If you helped I thank you for helping me, if you tried to help thank you too, this is quite hard.

1 comment
Formatting