LocalScript in StarterPlayer → StarterCharacterScripts,
I couldnt figure out how to freeze the playing sounds
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Camera = workspace.CurrentCamera
local FreezeEffect = function(Time)
for i,v in pairs(Character:GetChildren()) do --// Freeze character
if (v:IsA("BasePart")) then
v.Anchored = true
end
end --\\
Camera.CameraType = Enum.CameraType.Scriptable --|| Freeze screen
task.spawn(function() --// Unfreeze after Time passed
task.wait(Time)
for i,v in pairs(Character:GetChildren()) do
if (v:IsA("BasePart")) then
v.Anchored = false
end
end
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = Character.Humanoid
end) --\\
end
while true do
task.wait(7)
FreezeEffect(math.random(1, 3))
end
(It will freeze your game every 7 seconds for a random amount of time, you can just delete the while loop at the bottom to stop this.)
Time = 5 --Change the time to the seconds you want
function PauseGame()
for i,v in pairs(game:GetDescendants()) do
if v:IsA("BasePart") and v.Anchored == false then
v.Name = v.Name.."PAUSED"
v.Anchored = true
elseif v:IsA("Sound") and v.Playing == true then
v.Name = v.Name.."PAUSED"
v.Playing = false
end
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
end
wait(Time)
for i,v in pairs(game:GetDescendants()) do
if v:IsA("BasePart") and v.Anchored == true then
v.Name = string.split(v.Name,"PAUSED")[1]
v.Anchored = false
elseif v:IsA("Sound") and v.Playing == false then
v.Name = string.split(v.Name,"PAUSED")[1]
v.Playing = true
end
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end
end
PauseGame()