print("Server backup by BrennoMaturino1 (I am from brazil)") local ignore = { --Exemplo: workspace.Rocket --[[-- AQUI VÃO OS MODELOS QUE DEVERÃO SER IGNORADOS --]]-- workspace.Lobby, workspace.GameScripts, workspace.Terrain --workspace. --[[-- NOME DA INSTANCIA --]]-- --workspace. --[[-- NOME DA INSTANCIA --]]-- --workspace. --[[-- NOME DA INSTANCIA --]]-- --workspace. --[[-- NOME DA INSTANCIA --]]-- } local instances = {} --Não mexa, aqui são armazenados os modelos do jogo com excessão os que devem ser ignorados function PlayerJoined(player) player.CharacterAdded:Connect(function() if table.find(ignore, player.Character) == nil then table.insert(ignore, player.Character) else warn("O character do jogador: "..player.Name.." Foi adcionado mas já está na tabela") end end) end function ClearTable(tbl, IsInstance) if IsInstance == true then for number in pairs(tbl:GetChildren()) do table.remove(instances, number) end else for number in pairs(tbl) do table.remove(instances, number) end end end function CloneWorkspace() if table.getn(instances) ~= 0 then ClearTable(instances, false) end for number, instance in pairs(workspace:GetChildren()) do for number2, tableobj in pairs(ignore) do if instance ~= tableobj then local startclone = instance:Clone() local clone = nil if startclone then local clone = startclone:Clone() end table.insert(instances, clone) end end end end function RestoreLastBackup() for number, instance in pairs(workspace:GetChildren()) do for number2, tableobj in pairs(ignore) do if instance ~= tableobj then instance:Destroy() end end for number, instance in pairs(instances) do instance.Parent = workspace end end end workspace.GameScripts.Events.MakeBackup.OnServerEvent:Connect(CloneWorkspace) workspace.GameScripts.Events.RestoreBackup.OnServerEvent:Connect(RestoreLastBackup)
I need to pairs workspace while i pairs the ignore table The ignore table not is ignoring the models, i need to synchronize the workspace and the ignore table
You don't need to loop both of these tables, just loop one and use if statements to see if it's on the ignore table using ignore[1] to identify the position of the table.
print("Server backup by BrennoMaturino1 (I am from brazil)") local ignore = { --Exemplo: workspace.Rocket --[[-- AQUI VÃO OS MODELOS QUE DEVERÃO SER IGNORADOS --]]-- workspace.Lobby, workspace.GameScripts, workspace.Terrain --workspace. --[[-- NOME DA INSTANCIA --]]-- --workspace. --[[-- NOME DA INSTANCIA --]]-- --workspace. --[[-- NOME DA INSTANCIA --]]-- --workspace. --[[-- NOME DA INSTANCIA --]]-- } local instances = {} --Não mexa, aqui são armazenados os modelos do jogo com excessão os que devem ser ignorados function PlayerJoined(player) player.CharacterAdded:Connect(function() if table.find(ignore, player.Character) == nil then table.insert(ignore, player.Character) else warn("O character do jogador: "..player.Name.." Foi adcionado mas já está na tabela") end end) end function ClearTable(tbl, IsInstance) if IsInstance == true then for number in pairs(tbl:GetChildren()) do table.remove(instances, number) end else for number in pairs(tbl) do table.remove(instances, number) end end end function CloneWorkspace() if table.getn(instances) ~= 0 then ClearTable(instances, false) end for number, instance in pairs(workspace:GetChildren()) do for number2, tableobj in pairs(ignore) do if instance ~= tableobj then local startclone = instance:Clone() local clone = nil if startclone then local clone = startclone:Clone() end table.insert(instances, clone) end end end end function RestoreLastBackup() for number, instance in pairs(workspace:GetChildren()) do if instance ~= ignore[1] or instance ~= ignore[2] or instance ~= ignore[3] then instance:Destroy() else instance.Parent = workspace end end end workspace.GameScripts.Events.MakeBackup.OnServerEvent:Connect(CloneWorkspace) workspace.GameScripts.Events.RestoreBackup.OnServerEvent:Connect(RestoreLastBackup)
I hope this helped you!