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

Script that saves Players table outputs error?

Asked by
iladoga 129
5 years ago

I have a script that saves a players table using data store but whenever I save the players table it comes out with this error.

"Cannot convert mixed or non-array tables: keys must be strings" Here are my scripts:

Local script:

for i,v in pairs(KnifesFrame.ShopFrame:GetChildren()) do
    if v:IsA("ImageButton") then
         click = v.MouseButton1Click:connect(function()
            KnifesFrame.KnifeName.Text = v.KnifeName.Value
            KnifesFrame.Knife.Image = v.PicID.Value
            KnifesFrame.Knife.Visible = true
            KnifesFrame.Buy.Visible = true
            KnifesFrame.Buy.Active = true
            KnifesFrame.Buy.MouseButton1Click:connect(function()
                RemoteEvents.KniveEvents.BuyKnife:FireServer(v.KnifeName.Value,v.Amount.Value)
                RemoteEvents.KniveEvents.BuyKnife.OnClientEvent:connect(function(success)
                    if success == true then
                        table.insert(Knifes,#Knifes,v.KnifeName.Value)
                        RemoteEvents.KniveEvents.SaveKnives:FireServer(Knifes) -- THis is where I am getting told that the problem is but I have no idea whats wrong?
                        KnifesFrame.KnifeName.Text = "Success!"
                        wait(2)
                        KnifesFrame.KnifeName.Text = ""
                        KnifesFrame.Buy.Visible = false
                        KnifesFrame.Buy.Active = false
                        click:disconnect()
                    else
                        KnifesFrame.Buy.Visible = false
                        KnifesFrame.Buy.Active = false
                        KnifesFrame.KnifeName.Text = "You dont have enough points for this item!"
                        wait(2)
                        KnifesFrame.KnifeName.Text = ""
                        click:disconnect()
                    end
                end)
            end)
        end)
    end
end
0
wheres ur "Knifes" table User#23365 30 — 5y
0
Its in that script at the top iladoga 129 — 5y

Answer this question