equip system doesn't work but i start game Value Don't create what is it? Help
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
01 | local dsService = game:GetService( "DataStoreService" ) |
02 | local ds = dsService:GetDataStore( "Buy10" ) |
06 | game.ReplicatedStorage.GameClient.Events.RemoteEvent.PlayerLoaded.OnServerEvent:Connect( function (player) |
07 | local equippedlast = Instance.new( "StringValue" ) |
08 | equippedlast.Name = "Equipped" |
09 | local save = ds:GetAsync(player.UserId) |
11 | equippedlast.Value = save |
14 | for i, tool in pairs (game.ServerStorage.Tools:GetChildren()) do |
15 | if tool:FindFirstChild( "ItemNumber" ) then |
16 | if tool.ItemNumber.Value = = 1 then |
22 | equippedlast.Value = name |
25 | equippedlast.Parent = player |
27 | local clone = game.ServerStorage.Tools:FindFirstChild(equippedlast.Value):Clone() |
28 | clone.Parent = player:WaitForChild( "Backpack" ) |
34 | game.Players.PlayerRemoving:Connect( function (player) |
36 | ds:SetAsync(player.UserId, player.Equipped.Value) |