Get client FPS trough a script

This isn’t a good way of detecting this. There will be tons of false positives, and it doesn’t necessarily freeze the exploiters computer when they try to save.

6 Likes

False positives yes but its honestly the only way there is right now sadly. And to freeze the exploit i run a simple “while true do” loop which crashes the user.

Well, all those checks are done locally meaning the exploiter can easily bypass them, Its kind of impossible to determine if someone is trying to do something like that if you’re just gonna do local checks (which is your only option)

So it’s better to ruin the user’s experience by randomly getting crashed in your game for no reason from false positives? The user experience should always be first, not trying to stop exploits with client side detection that will just simply get bypassed by exploiters. It will just ruin the user’s experience more than it stops exploits most likely.

6 Likes

Its for an airport, which has max 60 users at one time when we have a flight. Fair point though.

I have a much more complicated method, but it’s pretty accurate last I checked.

local RunService = game:GetService("RunService")
local FpsLabel = script.Parent

local TimeFunction = RunService:IsRunning() and time or os.clock

local LastIteration, Start
local FrameUpdateTable = {}

local function HeartbeatUpdate()
	LastIteration = TimeFunction()
	for Index = #FrameUpdateTable, 1, -1 do
		FrameUpdateTable[Index + 1] = FrameUpdateTable[Index] >= LastIteration - 1 and FrameUpdateTable[Index] or nil
	end

	FrameUpdateTable[1] = LastIteration
	FpsLabel.Text = tostring(math.floor(TimeFunction() - Start >= 1 and #FrameUpdateTable or #FrameUpdateTable / (TimeFunction() - Start))) .. " FPS"
end

Start = TimeFunction()
RunService.Heartbeat:Connect(HeartbeatUpdate)

For the new VM:

local RunService = game:GetService("RunService")
local FpsLabel = script.Parent
local TimeFunction = RunService:IsRunning() and time or os.clock

local LastIteration, Start
local FrameUpdateTable = {}

local function HeartbeatUpdate()
	LastIteration = TimeFunction()
	for Index = #FrameUpdateTable, 1, -1 do
		FrameUpdateTable[Index + 1] = FrameUpdateTable[Index] >= LastIteration - 1 and FrameUpdateTable[Index] or nil
	end

	FrameUpdateTable[1] = LastIteration
	FpsLabel.Text = tostring(math.floor(TimeFunction() - Start >= 1 and #FrameUpdateTable or #FrameUpdateTable / (TimeFunction() - Start))) .. " FPS"
end

Start = TimeFunction()
RunService.Heartbeat:Connect(HeartbeatUpdate)
139 Likes

I have one!

game:GetService("RunService").RenderStepped:Wait()

that’s it. you can while wait() do and use it that way and show it in a gui

3 Likes

Thank you, works perfect and updates fps way faster then the method i used before.

I don’t see any benefit to this compared to local fps = 1 / RunService.RenderStepped:wait().

1 Like

Mine is more accurate than doing just that.
image image image

9 Likes

Can you try 1 / RunService.Heartbeat:wait() as well?

1 Like

image image image

11 Likes

Yeah I forgot 1/fps excuse me for that :slight_smile:

1 Like

It’s fine. It’s just less accurate than my method. It’s faster though, that’s for sure.

3 Likes

quite literally the opposite,i was making an antiexploit/ antisave.

Why would you necro the tread after TWO YEARS?

5 Likes

Before the second screenshot, you wrote “new VM”
What does “VM” mean??

I believe it means virtual machine, correct me if I am wrong though.

5 Likes

has been a while since this was written but can somone tell me how i would like take the number of FPS and lets say the player has less than 15 fps they get kicked out of the game (ik how to do the kicking part)

This isn’t a good idea. Often, when the game loads, the fps is very low as it starts rendering new things, loading in assets, and all that. Also, kicking someone for low FPS is not a good idea, since it literally reduces how many players you have.

If you REALLY need to though…

local LocalPlayer = game:GetService("Players").LocalPlayer
local RunService = game:GetService("RunService")
local FpsLabel = script.Parent
local TimeFunction = RunService:IsRunning() and time or os.clock

local LastIteration, Start
local FrameUpdateTable = {}

local function HeartbeatUpdate()
	LastIteration = TimeFunction()
	for Index = #FrameUpdateTable, 1, -1 do
		FrameUpdateTable[Index + 1] = FrameUpdateTable[Index] >= LastIteration - 1 and FrameUpdateTable[Index] or nil
	end

	FrameUpdateTable[1] = LastIteration
	local FPS = (math.floor(TimeFunction() - Start >= 1 and #FrameUpdateTable or #FrameUpdateTable / (TimeFunction() - Start)))
	FpsLabel.Text = tostring(FPS) .. " FPS"
	if FPS < 15 then
		LocalPlayer:Kick("Too low FPS!")
	end
end

Start = TimeFunction()
RunService.Heartbeat:Connect(HeartbeatUpdate)