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

equip system doesn't work but i start game Value Don't create what is it? Help

Asked by 4 years ago

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

01local dsService = game:GetService("DataStoreService")
02local ds = dsService:GetDataStore("Buy10")
03 
04 
05 
06game.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)
10    if save then
11        equippedlast.Value = save
12    else
13        local name
14        for i, tool in pairs(game.ServerStorage.Tools:GetChildren()) do
15            if tool:FindFirstChild("ItemNumber") then
View all 38 lines...

1 answer

Log in to vote
1
Answered by
Ludzik78 136
4 years ago

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.

0
hello, could you explain where to write where StringValue is? YTBrainBroYT 29 — 4y
0
so your saying where StringValue is? as i was saying, replace the save at Line 11 with save['variablename] Ludzik78 136 — 4y
0
worked but got an error at line 27 ServerScriptService.LastEquipped:27: attempt to index nil with 'Clone' YTBrainBroYT 29 — 4y
Ad

Answer this question