[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 _, v in pairs(tbl:GetChildren()) do v:Destroy() 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 --[[ local _workspace = workspace:GetChildren() for i = 1,#_workspace do for j = 1, #ignore do if _workspace[i] ~= ignore[j] then local startclone = workspace[i]:Clone() local clone = nil if startclone then local clone = startclone:Clone() end table.insert(instances, clone) end end --]] local _workspace = workspace:GetChildren() for i = 1, #_workspace do for j = 1, #ignore do if _workspace[i] ~= ignore[j] then local startclone = workspace[i]:Clone() local clone = nil if startclone then local clone = startclone:Clone() end end end end --end end function RestoreLastBackup() --[[ if table.getn(instances) == 0 then return end local _workspace = workspace:GetChildren() for i = 1, #_workspace do for j = 1, #ignore do if _workspace[i] ~= ignore[j] then _workspace[i]:Destroy() end end end --]] local _workspace = workspace:GetChildren() for i = 1, #_workspace do for j = 1, #ignore do if _workspace[i] ~= ignore[j] then workspace[i]:Destroy() end end end for number, instance in pairs(instances) do instance.Parent = workspace end end workspace.GameScripts.Events.MakeBackup.OnServerEvent:Connect(CloneWorkspace) workspace.GameScripts.Events.RestoreBackup.OnServerEvent:Connect(RestoreLastBackup) game:GetService("Players").PlayerAdded:Connect(PlayerJoined)
Script error: 1 is not a valid member of Workspace
Stack Begin
Script 'Workspace.GameScripts.ServerBackupV2', Line 66 - function CloneWorkspace
Stack End