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

Saving this table using DataSave is deciding not to work, anyone know why?

Asked by 2 years ago
Edited 2 years ago

I honestly have no clue why this isn't working. The loading part of the script (not here) works fine, it just won't save the table.

game.Players.PlayerAdded:Connect(function(player)
    local data
    local sucess, errormessage = pcall(function()
        data = eqSave:GetAsync(player.UserId.."-Equip")
        print(data.equip)
        if data then
            print("AtIF")
            local Folder = Instance.new("Folder",player)
            Folder.Parent = player
            Folder.Name = "equipped"
            for i, v in pairs(data.equip) do
                game.ReplicatedStorage.Gear:WaitForChild(v.nameValue)
                print(v.nameValue)
                if game.ReplicatedStorage.Gear:FindFirstChild(v.nameValue) then
                    local BPK = player.BPK
                    local invalue = #BPK:GetChildren()
                    local tool = game.ReplicatedStorage.Gear[v.nameValue]:Clone()
                    tool.Parent = player:WaitForChild("equipped")
                    tool.Name = v.Name..invalue
                    tool.Damage.Value = v.Damage
                    tool.Rarity.Value = v.Rarity
                    tool.Type.Value = v.Type
                    tool.Description.Value = v.Description
                    tool.MinLevel.Value = v.MinLevel
                    tool.Equippted.Value = v.Equippted
                    tool.nameValue.Value = v.nameValue
0
Found out the problem wasn't saving the code, but loading it. It will get the table perfectly fine but won't clone the object I want it to. I will change the post to show that. Noahbb22 2 — 2y
0
It worked for a second and then stopped working after I got rid of a print line for debugging. I think it is a problem with timing. I will see. Noahbb22 2 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

It seems that everything worked, but the script was crashing and not going forward. I don't know why it happened but I gave it a wait and it seems to work now.

Ad

Answer this question