Can a script check the specifications of a player

Hi
I’m wondering if its possible to check the specifications of a player through a script so I can make a UI that tells the user that they may experience lag/problems etc if they play on very low end hardware

You can detect if the player is on mobile/pc, what their fps is, etc. I suggest doing a bit more research next time.
To calculate people’s fps use RunService.RenderStepped this should be done locally.
You can calculate it by doing the following: (there are multiple ways to calculate it this being one of them)

local fps = 0
local RunService = game:GetSerive("RunService")

RunService.RenderStepped:Connect(function(step)
	fps += 1
	spawn(function()
		wait(1)
		fps -= 1
	end)
end)

and for the mobile detection: (if this is false it’s either PC or Xbox)

I am fully aware of this method but I wanted to know if there was a better way to get their specs rather than calculating fps

No there’s not.
Tho do some research on every way that you can calculate FPS with.

Adding on to what @KJry_s has mentioned, you can if you really wanted do, get the average framerate over a time period, and use that to determine FPS, as it would be stable.

You may also just set number variables for the FPS, and compare them to clients.

It’s questionable why Roblox doesn’t provide any way to get specs on devices. A lot of other applications have this. Perhaps you can a file a feature when you’re able to (given it hasn’t been done before)

Edit: Don’t mark me as a solution. The guy above provided what you needed.

Yes I dont understand either
(I work a lot with Unreal)

Dear god, don’t do that, you’re starting up a bunch of threads for no reason.

You can keep a start timestamp and then count the fps you traversed in that time:

local diff = 0
local count = 0

local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function(step)
   diff += step
   count += 1
   if diff > 1 then
     print("estimated fps:", count / diff)
     diff = 0
     count = 0
   end
end)

However, I don’t really understand why you need to know the FPS. I’ve never written code for a Roblox game before where I needed to know the actual FPS number for any reason. You can probably do without and you should, because the code above is still very hacky.

3 Likes

The device type alone doesn’t provide enough information about performance. Although you can assume that mobile has worse performance than pc and Xbox is somewhere in between; this simply isn’t true for all cases.
I know of many simulators that probably get your FPS because solely relying on device type isn’t accurate. I could be playing a sim on my iPhone X - performance is awesome, but since I’m on mobile, a system such as a LOD toggle would assume my performance is bad.

For cases like this, dependency on device type isn’t reliable. And it’s probably the closest we can get to catering to device performance - atleast that I know of.

I don’t think FPS is any sort of good indicator for device performance. You can’t distinguish between running at 60FPS at full throttle or only using a fraction of device performance. For mobile devices specifically, you always want to use fewer resources if you can, even if you are already at max FPS, because you’re not only optimizing against FPS but also against battery life.

On the other hand, for shooters for example, a user might want the highest possible FPS so that their inputs are handled as quickly/frequently as possible. Suppose Roblox supports unlimited FPS in the future, then if you start churning more resources out of the device as FPS exceeds 60, that would be pretty bad for what the user actually wanted to achieve.

Overall this is a bad idea. It’s probably better to provide users with sliders/settings so they can toggle whatever kind of experience they want to have. FPS isn’t meaningful enough to use for this.

This is true. I never thought about that.

Well, what other way is there to identify performance? We shouldn’t simply rely on device type because that isn’t accurate given the entire spectrum.

I see. This is probably better then relying on FPS. I do question why this isn’t done. It’s frankly disappointing that Roblox doesn’t provide this. I know this probably isn’t that hard to do, and giving users the ability to customise to help performance in games, e.g removing textures, reducing particle emitters, ect.