hi recently started to create my own game and there was a difficulty in the store I am asking for help 2 times already because I do not have special information in the field of scripting here is an error
ServerScriptService.LastEquipped:11: invalid argument #3 (string expected, got table)
here is the script itself
local dsService = game:GetService("DataStoreService") local ds = dsService:GetDataStore("Buy10") game.ReplicatedStorage.GameClient.Events.RemoteEvent.PlayerLoaded.OnServerEvent:Connect(function(player) local equippedlast = Instance.new("StringValue") equippedlast.Name = "Equipped" local save = ds:GetAsync(player.UserId) if save then equippedlast.Value = save else local name for i, tool in pairs(game.ServerStorage.Tools:GetChildren()) do if tool:FindFirstChild("ItemNumber") then if tool.ItemNumber.Value == 1 then name = tool.Name end end end equippedlast.Value = name end equippedlast.Parent = player local clone = game.ServerStorage.Tools:FindFirstChild(equippedlast.Value):Clone() clone.Parent = player:WaitForChild("Backpack") end) game.Players.PlayerRemoving:Connect(function(player) ds:SetAsync(player.UserId, player.Equipped.Value) end)
save is a table, thats why it says string expected, got table. Print out the table, then do save['(write the name of the variable name your looking for here)'] instead of just save. Let me know if this doesnt work.