Prevent Tab Glitching

How could I prevent tab-glitching.
Preferably from the server, but I don’t mind the client.

2 Likes

May I ask what “tab-glitching” is?

Tab Glitching is when desktop (Windows) users repeatedly tap / right-click the close button / minimise button to make their avatar move slower. This is mainly to fall down slower or phase through moving objects.

I’m pretty sure this is a bug on Roblox’s end and so I don’t think can be fixed. Correct me if I’m wrong because I probably am.

Yes, you can:

  • In a LocalScript, detect if their framerate drops and rises very inconsistently.

  • In a ServerScript, detect if the player has a ping over 1 second or their HumanoidRootPart has not moved at all when their velocity is not zero.

1 Like

You clearly know better about this stuff than I do. :sweat_smile:

How would you detect the framerate though?

local frameTime = 1/dt

That would give the framerate, assuming delta time is each time between frame.

3 Likes

I’m a bit confused with the server method you mentioned.

You would basically check if the player’s position hasn’t changed but their velocity isn’t at zero. In other words, they should be physically moving, but they aren’t. If a script detects this, it can kick the player.

Hmm, Yes.
But this could maybe false flag?

Maybe, but that’s only if they have very high ping and are on a very slow device. The times it would false flag are people running on a 2004 computer.

3 Likes
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player: Player)
	Player.CharacterAdded:Connect(function(Character)
		local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
		
		task.spawn(function()
			while task.wait() do
				local Position = HumanoidRootPart.Position
				local Velocity = HumanoidRootPart.Velocity

				task.wait(.5)

				local NewPosition = HumanoidRootPart.Position
				local NewVelocity = HumanoidRootPart.Velocity
				
				print(Position)
				print(Velocity)
				
				print(NewPosition)
				print(NewVelocity)

				if Position == NewPosition and NewVelocity ~= Vector3.new(0,0,0) then
					Player:Kick()
				end
			end
		end)
	end)
end)

Help me out here.

1 Like

Seems about right, but it could probably be more optimized if you removed the task.wait() and replace it with true. You also don’t need the task.spawn

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.