So I made a time stop script, it worked perfectly, until there was a bug that people could time stop while they were stopped. I tried to patch it, but it breaks the entire script.
SERVERSCRIPT:
local Debounce = false
local DebounceCoolDown = 30
local timeTillUnfreeze = 5
game.ReplicatedStorage.Event.OnServerEvent:Connect(function(playerWhoFired)
game.Workspace.Sound2:Play()
if Debounce == false then
Debounce = true
game.Lighting.ColorCorrection.Saturation = -1
for i, player in pairs(game.Players:GetPlayers()) do
if player ~= playerWhoFired then --
player.Character.HumanoidRootPart.Anchored = true
Debounce = false
end
end
wait(5)
game.Lighting.ColorCorrection.Contrast = 0
game.Lighting.ColorCorrection.Saturation = 0
wait(timeTillUnfreeze)
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.HumanoidRootPart.Anchored = false
wait(DebounceCoolDown)
end
end
end)
LOCALSCRIPT:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")
game:GetService("Players")
local run = Instance.new("Animation")
run.AnimationId = "rbxassetid://5458518027"
local runtrack = Humanoid:LoadAnimation(run)
local remoteeventt = game.ReplicatedStorage.Event
local isTimestopped = character.HumanoidRootPart.Anchored == true
local timestopAnchor = 5
if character.HumanoidRootPart.Anchored == true then
isTimestopped = true
game:GetService("UserInputService").InputBegan:Connect(function(Input,gameProcessed)
if gameProcessed then return end --If they are chatting or doing some other things, don't continue
if Input.KeyCode == Enum.KeyCode.F then
if Debounce == false then
Debounce = true
if isTimestopped == false then
remoteeventt:FireServer("playerWhoFired")--Telling the server to freeze everybody'
runtrack:Play()
else wait(timestopAnchor)
wait(DebounceCoolDown)
Debounce = false
if character.HumanoidRootPart.Anchored == false then
isTimestopped = false
end
end
end
end
end)
end
for i, player in pairs(game.Players:GetPlayers()) do
if player ~= playerWhoFired then --
player.Character.HumanoidRootPart.Anchored = true
Debounce = false
end
end
You have your debounce so high up in the script, when in reality it should be the last thing you re-enable, try moving your debounce down here:
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.HumanoidRootPart.Anchored = false
wait(DebounceCoolDown)
end
end
Debounce = false
SERVERSCRIPT:
local Debounce = false
local DebounceCoolDown = 30
local timeTillUnfreeze = 5
game.ReplicatedStorage.Event.OnServerEvent:Connect(function(playerWhoFired)
game.Workspace.Sound2:Play()
game.Lighting.ColorCorrection.Saturation = -1
for i, player in pairs(game.Players:GetPlayers()) do
if player ~= playerWhoFired then --
player.Character.HumanoidRootPart.Anchored = true
wait(5)
game.Lighting.ColorCorrection.Contrast = 0
game.Lighting.ColorCorrection.Saturation = 0
wait(timeTillUnfreeze)
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.HumanoidRootPart.Anchored = false
wait(DebounceCoolDown)
Debounce = false
end
end
end
end
end)
LOCAL SCRIPT:
local timestopanchor = 6
local isTimestopped = false
local Debounce = false
local DebounceCoolDown = 30
local timestopstartup = 1.5
local Lighting = game.Lighting
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")
game:GetService("Players")
local run = Instance.new("Animation")
run.AnimationId = "rbxassetid://5458518027"
local runtrack = Humanoid:LoadAnimation(run)
local remoteeventt = game.ReplicatedStorage.Event
local isTimestopped = character.HumanoidRootPart.Anchored == true
local timestopAnchor = 5
if character.HumanoidRootPart.Anchored == true then
isTimestopped = true
game:GetService("UserInputService").InputBegan:Connect(function(Input,gameProcessed)
if gameProcessed then return end --If they are chatting or doing some other things, don't continue
if Input.KeyCode == Enum.KeyCode.F then
if Debounce == false then
Debounce = true
if isTimestopped == false then
remoteeventt:FireServer("playerWhoFired")--Telling the server to freeze everybody'
runtrack:Play()
else wait(timestopAnchor)
if character.HumanoidRootPart.Anchored == false then
isTimestopped = false
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.HumanoidRootPart.Anchored = false
wait(DebounceCoolDown)
end
end
Debounce = false
end
end
end
end)
end
Not sure if its something about the Debounce, could I get some help?
Alright, so I kind of removed the parts of the Anchor to make it in a working spot, would it be possible if I can implement something that if the player is anchored, the RemoteEvent won’t fire?
SERVER SCRIPT:
local timeTillUnfreeze = 5
local Debounce = false
local DebounceCooldown = 30
local remoteeventt = game.ReplicatedStorage.Event
remoteeventt.OnServerEvent:Connect(function(playerWhoFired)
if Debounce == true then
wait(DebounceCooldown)
else game.Workspace.Sound2:Play()
game.Lighting.ColorCorrection.Saturation = -1
game.Lighting.ColorCorrection.Contrast = -2
if Debounce == false
then Debounce = true
for i, player in pairs(game.Players:GetPlayers()) do
if player ~= playerWhoFired then --
player.Character.HumanoidRootPart.Anchored = true
end
end
wait(timeTillUnfreeze)
game.Lighting.ColorCorrection.Contrast = 0
game.Lighting.ColorCorrection.Saturation = 0
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.HumanoidRootPart.Anchored = false
wait(DebounceCooldown)
Debounce = false
end
end
end
end)
LOCALSCRIPT:
local timestopanchor = 6
local isTimestopped = false
local Debounce = false
local DebounceCoolDown = 30
local timestopstartup = 1.5
local Lighting = game.Lighting
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")
game:GetService("Players")
local run = Instance.new("Animation")
run.AnimationId = "rbxassetid://5458518027"
local runtrack = Humanoid:LoadAnimation(run)
local remoteeventt = game.ReplicatedStorage.Event
local isTimestopped = character.HumanoidRootPart.Anchored == true
local timestopAnchor = 5
game:GetService("UserInputService").InputBegan:Connect(function(Input,gameProcessed)
if gameProcessed then return end --If they are chatting or doing some other things, don't continue
if Input.KeyCode == Enum.KeyCode.F then
if Debounce == true then
wait(DebounceCoolDown)
else remoteeventt:FireServer("playerWhoFired")--Telling the server to freeze everybody'
runtrack:Play()
Debounce = false
end
end
end)
Added this to the local script,
local timestopanchor = 6
local isTimestopped = false
local Debounce = false
local DebounceCoolDown = 30
local timestopstartup = 1.5
local Lighting = game.Lighting
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local isAnchored = game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored == true
local Humanoid = character:WaitForChild("Humanoid")
game:GetService("Players")
local run = Instance.new("Animation")
run.AnimationId = "rbxassetid://5458518027"
local runtrack = Humanoid:LoadAnimation(run)
local remoteeventt = game.ReplicatedStorage.Event
local isTimestopped = character.HumanoidRootPart.Anchored == true
local timestopAnchor = 5
game:GetService("UserInputService").InputBegan:Connect(function(Input,gameProcessed)
if gameProcessed then return end --If they are chatting or doing some other things, don't continue
if Input.KeyCode == Enum.KeyCode.F then
if Debounce == true then
wait(DebounceCoolDown)
else if isAnchored == true
then wait(timestopAnchor)
else remoteeventt:FireServer("playerWhoFired")--Telling the server to freeze everybody'
runtrack:Play()
wait (DebounceCoolDown)
Debounce = false
end
end
end
end)
but it says, “HumanoidRootPart is not a valid member of model”
Line 9 is creating the error.
Nevermind! I fixed it.
(Putting this as solution.)