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

This is my load script but it doesn't load correctly?

Asked by 3 years ago

everything loads with same days value ( and world name )

local Folder

local function load(player)
    local saved1 = WorldData:GetAsync(player.UserId.."-World")
    local saved2 = WorldDays:GetAsync(player.UserId.."-Days")
    print(saved1)
    print(saved2)

    if saved1 ~= nil and saved2 ~= nil then 
        for _, loadFolder in pairs(saved1) do
            if not PlayerStats[player.Name]:FindFirstChild(loadFolder) then
            Folder = Instance.new("Folder", PlayerStats[player.Name]) 
            Folder.Name = loadFolder
            for _, loadvalues in pairs(saved1) do       
                    for _, loadvalues2 in pairs(saved2) do
                    if #Folder:GetChildren() <= 1 then
                            local newval = Instance.new("StringValue", Folder)
                            newval.Name = "WorldName"
                            newval.Value = loadvalues

                            local newval2 = Instance.new("IntValue", Folder)
                            newval2.Name = "Days"
                            newval2.Value = loadvalues2
                        end
                    end
                end
            end 
        end
    end
end

0
k i think i fixed myself JohnerDev 27 — 3y

Answer this question