XxMirayxX21

H3x0Rs Ownership Script v2.1.1

Mar 27th, 2021
593
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- H3x0Rs Ownership Script v2.1.1
  2. local PlayerInstance;
  3. local getgenv = getgenv or function() return _G end
  4. local sethiddenprop = (sethiddenproperty or set_hidden_property or sethiddenprop or set_hidden_prop)
  5. local setsimulationrad = setsimulationradius or set_simulation_radius or function(Radius) sethiddenprop(PlayerInstance, "SimulationRadius", Radius) end
  6. if not getgenv or not sethiddenprop or not setsimulationrad then return false end -- Not supported
  7. if getgenv().NETWORKOWNER then getgenv().NETWORKOWNER:Disconnect() getgenv().NETWORKPLAYERCHECK:Disconnect() getgenv().NETWORKPLAYERCHECK2:Disconnect() end
  8. getgenv().NETWORK_RADIUS = NETWORK_RADIUS or 1000
  9.  
  10. if not isfile("network-ownership.log") then
  11.     writefile("network-ownership.log", "Script executed on game "..game.PlaceId.."!\n")
  12. else
  13.     appendfile("network-ownership.log", "Script executed on game "..game.PlaceId.."!\n")
  14. end
  15.  
  16. if not game:IsLoaded() then
  17.     appendfile("network-ownership.log", "Waiting for game to load...\n")
  18.     game.Loaded:Wait() -- Wait for game
  19. end
  20.  
  21. -- Grab services
  22. local RunService = game:GetService("RunService")
  23. local Players = game:GetService("Players")
  24. PlayerInstance = Players.LocalPlayer
  25.  
  26. -- Optimize
  27. local PlayerList = {}
  28. for _, Plr in pairs(Players:GetPlayers()) do
  29.     if Plr ~= PlayerInstance then
  30.         PlayerList[Plr] = true
  31.     end
  32. end
  33.  
  34. getgenv().NETWORKPLAYERCHECK = Players.PlayerAdded:Connect(function(Plr)
  35.     PlayerList[Plr] = true
  36. end)
  37.  
  38. getgenv().NETWORKPLAYERCHECK2 = Players.PlayerRemoving:Connect(function(Plr)
  39.     local Success, Err = pcall(function() PlayerList[Plr] = nil end)
  40.     if not Success then
  41.         appendfile("network-ownership.log", "Error while de-registering player that left: "..tostring(Err).."\n")
  42.     end
  43. end)
  44.  
  45. -- Configure network services
  46. settings().Physics.AllowSleep = false -- Keep the current physics system from sleeping. (Non-moving parts lose ownership.)
  47. settings().Physics.PhysicsEnvironmentalThrottle = Enum.EnviromentalPhysicsThrottle.Disabled -- Keep the physics from throttling.
  48.  
  49. -- Start network runtime
  50. getgenv().NETWORKOWNER = RunService.Stepped:Connect(function()
  51.     -- Revoke ownership from others
  52.     for Plr, _ in pairs(PlayerList) do
  53.         sethiddenprop(Plr, "MaximumSimulationRadius", 0.01)
  54.         sethiddenprop(Plr, "SimulationRadius", 0.01)
  55.     end
  56.  
  57.     -- Claim ownership for me
  58.     sethiddenprop(PlayerInstance, "MaximumSimulationRadius", NETWORK_RADIUS)
  59.     setsimulationrad(NETWORK_RADIUS)
  60. end)
  61.  
  62. return true
RAW Paste Data