Basically, is there a way to revert all the changes made by any scripts and general roblox stuff like physics and then re-run the scripts again?
For example, if I have a script that makes some changes to the place, e.g.
-- Random stuff inside a script
local part = Instance.new("Part", workspace)
part.Size = Vector3.new(5,10,8)
part.Anchored = true
part.Position = Vector3.new(math.random(1,5), 10, math.random(1, 9))
workspace:SetAttribute("myAttribute", CFrame.new())
game.Lighting.Atmosphere.Density = 0.6
workspace.RandomSound:Play()
require(randomModuleID)
_G.test = function()
print("hello world!")
end)
game.Players.PlayerAdded:Connect(function(player)
print(player, "Joined!")
player:SetAttribute("joined", true)
end)
Is there a way to revert everything and restore the place to its original state? I understand that stopping the game and re-teleporting all the players works but is there another way?