How to stop people from freezing

If you haven’t heard about the widely popular freeze glitch let me fill you in. You can freeze your client by holding right click at the top bar in windowed mode. Not only does this freeze you in place, even if your in mid air, it stops all local scripts from running too. It also stops all .Touched events from firing on the player, so you can completely bypass spinners. Fret not, for there is hope. With these 16 lines of code you can completely stop players from doing this.

local RS = game:GetService("RunService")
local player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
local HB = RS.Heartbeat
function WaiT(seconds)
	local start = tick()
	repeat HB:Wait() until (tick()-start) >= seconds
	return seconds
end
while true do
	local Start = tick()
	WaiT(0.1)
	if (math.abs(tick()-Start)) > 0.2 then
		player:Kick('Freezing') -- Adjust the punishment to whatever fits your needs
	end
end

Now there are some downsides to this. If a player accidently holds right click for a few fractions of a second and lets go they will be kicked. That’s why you can customize the time frozen that constitutes a kick and the punishment for freezing to fit your needs. Posted this because I haven’t seen a tutorial on a quick and easy way to patch this bug yourself. By the way this is a local script in starterplayerscripts.

10 Likes

Wouldn’t this also kick laggy players? Why would you ever punish a player for this anyways lol?

4 Likes

I know right? They are only really hurting themselves, not anyone else. I did not know about this glitch even.

1 Like

This doesn’t kick laggy players, since its run on the client not the server. Even when your internet goes out, the client still runs until you eventually get disconnected. Also you can bypass a ton of mechanics in games, such as stopping blocks from hitting you, and camping in mid air in a survival type game.

2 Likes

By laggy he probably meant people with performance issues because this will affect them

1 Like

What am I supposed to use this for? Punish others because they have performance issues…?

3 Likes

This won’t affect people with preformance issues, it only goes off if the client freezes entirely. Even if the player is running at 10 fps the custom wait function will still be accurate to the degree specified And if your game is preformance heavy you can always just increase the wait time to 1 second to make it accurate even if the player is running at 1 fps.

2 Likes

This would actually be super useful for all the round based survival games! I have seen plenty of people about to die from falling then they just freeze mid air for around 15 seconds and comback while saying “ez”. (im assuming this doesnt kick people who are honestly just laggy)

2 Likes

No, it doesn’t kick for being laggy, I tested it numerous times.

2 Likes

punish them for freezing by teleporting them to whatever hazard there is :}

1 Like

If someone uses this glitch to exploit, and it’s prevention script is client side… can’t they just delete it?

1 Like

They could probably put the localscript in the character and have a serverscript check each player and if they don’t have that localscript then they get kicked.

3 Likes

Exploiting is a whole different issue. Most people who use this glitch wont exploit so it is still effective. Also you could add an anti exploit that checks if scripts are destroyed.

1 Like

This will absolutely kick players with lower performant machines as lower FPS means that the time between updates takes longer, which is the exact same thing you’re checking.
Low FPS = larger time gaps between checks on tick()
Your Code: if time gap > 0.2 then kick player

3 Likes

You can use this to setup this system & detect if the script gets destroyed, and the destroyed detector is serversided:

Step 1: Make a script in SSS and put the following in the script:

for i, v in ipairs(game.Players:GetPlayers()) do --THE FOLLOWING ONLY WORKS IF THE LOCALSCRIPT'S PARENT IS THE ACTUAL PLAYER'S STARTERPACK!!!
    v.Backpack.ChildRemoved:Connect(function(child)
        if child.Name == "Put The Name Of The LocalScript Here" then
            local newClone = script.LocalScript:Clone()
            newClone.Parent = v.Backpack
            newClone.Disabled = false
        end
    end
end

Step 2: Make a localscript named “LocalScript” as a child of the above script AND MAKE IT DISABLED! Put this code in it:

-- This is basically the OP code
local RS = game:GetService("RunService")
local player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
local HB = RS.Heartbeat
function WaiT(seconds)
	local start = tick()
	repeat HB:Wait() until (tick()-start) >= seconds
	return seconds
end
while true do
	local Start = tick()
	WaiT(0.1)
	if (math.abs(tick()-Start)) > 0.2 then
		player:Kick('Freezing') -- Adjust the punishment to whatever fits your needs
	end
end

Step 3: Make sure that you made another LocalScript with the above code in it labeled LocalScript and put it in StarterPack.

Done! :slight_smile:

1 Like

not having an update within 0.1 seconds means the llayer is running less than 10 fps. Thats why i recommended to change it to something like every 1 second with a gap of 2 so that way itd only kick them if they were freezing or running less than 1 fps for more than a second, which is realistically impossible.

2 Likes

This doesn’t actually work because changes like the script being disabled don’t replicate to the server.

7 Likes

But we’re changing the disabled property in the server… so isn’t it already replicated?

It doesn’t stop anything, i’ll tell you why though.

What your doing is adding back the localscript when it’s deleted. You also are disabling the scripts on the client, and enabling it on the server. But then guess what the exploiter does?

He/she disables the script after the server enables it. And the server won’t even know that the script was enabled back on the client, since it doesn’t replicate to the server.

2 Likes

Oh that makes a lot of sense now… I hate exploiters…

So basically check for Instance.Changed() and switch it?

EDIT: Or will the server not even detect the change?