themightycta

Advanced SaveInstance Roblox Working 2023

Mar 10th, 2023
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. -- Define a function to handle errors and log them to the Roblox output window
  2. local function handleError(errorMessage)
  3.     warn("[ERROR]: " .. errorMessage)
  4. end
  5.  
  6. -- Wrap the code in a pcall statement to catch any errors that may occur
  7. local success, error = pcall(function()
  8.     -- Get the RunService from the ScriptContext and call SaveInstance on the Workspace
  9.     local runService = game:GetService("RunService")
  10.     runService:SaveInstance(game.Workspace)
  11. end)
  12.  
  13. -- If an error occurred, handle it and log it to the output window
  14. if not success then
  15.     handleError("SaveInstance may not be supported yet: " .. error)
  16. end
  17.  
  18. -- themightycta
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment