Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if type(_G.SHUTDOWN_FREEZEPARTS) == "function" then
- _G.SHUTDOWN_FREEZEPARTS()
- end
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local RunService = game:GetService("RunService")
- local freeze = false
- local anchoredParts = {}
- local connect
- local connect2
- local inputconnect
- function isCharacter(instance)
- for _, p in pairs(Players:GetPlayers()) do
- if p.Character and typeof(instance) == "Instance" and instance:IsDescendantOf(p.Character) or instance == p.Character then
- return true
- end
- end
- return false
- end
- function _G.SHUTDOWN_FREEZEPARTS()
- if freeze then
- toggleFreeze()
- end
- if inputconnect then
- inputconnect:Disconnect()
- end
- end
- function toggleFreeze()
- if not freeze then
- freeze = true
- for _, v in pairs(workspace:GetDescendants()) do
- if v:IsA("BasePart") and not v.Anchored and not isCharacter(v) then
- v.Anchored = true
- anchoredParts[v] = true
- end
- end
- connect = workspace.DescendantAdded:Connect(function(c)
- if c:IsA("BasePart") and not c.Anchored and not isCharacter(c) then
- c.Anchored = true
- anchoredParts[c] = true
- end
- if c:IsA("BasePart") then
- local changedconnection
- changedconnection = c.Changed:Connect(function()
- if not freeze then
- changedconnection:Disconnect()
- return
- end
- if c:IsA("BasePart") and not c.Anchored and not isCharacter(c) then
- c.Anchored = true
- anchoredParts[c] = true
- end
- end)
- end
- end)
- connect2 = RunService.Heartbeat:Connect(function()
- for v, _ in pairs(anchoredParts) do
- if v.Anchored == false then
- v.Anchored = true
- end
- end
- end)
- else
- freeze = false
- if typeof(connect) == "RBXScriptConnection" then
- connect:Disconnect()
- end
- if typeof(connect2) == "RBXScriptConnection" then
- connect2:Disconnect()
- end
- for v, _ in pairs(anchoredParts) do
- v.Anchored = false
- end
- end
- end
- Players.LocalPlayer.SimulationRadius = math.huge
- inputconnect = UserInputService.InputEnded:Connect(function(input, isTyping)
- if input.KeyCode == Enum.KeyCode.F and not isTyping then
- toggleFreeze()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement