How Can I disable firstperson and cap the fps to 30?

Hello there.
Just need to know how Can I disable first person and Cap the Fps to 30 in game?
This is urgent I need it for my game its a 2006 ROBLOX Game.

If you know how to do any of these, will be appreciated.

Thank You.

3 Likes

Well, for the first person thing you could set the CameraMinZoomDistance to a higher number. This will limit how much the player can zoom in. Also, I would suggest putting this in the scripting support category.

You can’t do anything about the frame rate.

I know but I have seen games and they say that they capped the FPS (whatever number)
Also I have seen a model by flexbandjo (who has a 2006 game and caps the FPS To 30) but It’s not working. ill have to see if it works again or not. Mabye your right idk.

Actually from what I found you can cap it

I found this

Code in the post

local RunService = game:GetService("RunService")
local MaxFPS = 30
while true do
    local t0 = tick()
    RunService.RenderSteppedt:Wait()
    repeat until (t0 + 1/MaxFPS) < tick()
end

I tested it out by setting the MaxFPS to 15 and it capped it at 15 for me

@CakeValxie Should be of use to you. For the First person disabling, just do as @BluestOfFlames mentioned by setting the CameraMinZoomDistance to a higher number

3 Likes

Well that’s a scary use for busy waiting.

Were do I find the zoom distance and what should I set it to. My game is a nostalgia game of ROBLOX in 2006? Do you know what to set to or what you recommend for my game?

is it a local script of script and were should the script in workspace or what?

They’re located in the StarterPlayer’s Properties. Just click on StarterPlayer in the explorer, go to its properties, and you should see it with a value of 0.5, just increase to 2 or more until first person doesn’t enable

And for the code I mentioned, Localscript in StarterPlayerScripts if you want it to always cap your fps.

But if it’s a button, you can do similar to what I did for my testing, just instead parenting the localscript to the GuiButton

local RunService = game:GetService("RunService")
local MaxFPS = 30

local limit = false

script.Parent.MouseButton1Click:Connect(function()
	limit = not limit 
	while limit do
		local t0 = tick()
		RunService.RenderStepped:Wait()
		repeat until (t0 + 1/MaxFPS) < tick()
	end
end)
1 Like

sorry for disturbing but what type of script in a normal script or local and do i create it and put the script/localscript there?

The code I mentioned for fps capping should be in a localscript, but the location of it depends if you want to cap it constantly or when a button is pressed.

If you want to cap it always, just put it in StarterPlayerScripts

If you want it to cap when a button is pressed, you can use a script similar to mine in the button that toggles it

@nooneisback Testing both gave the same result but you do make a good point, I’ll edit my posts with the code to use RenderStepped

You should use RenderStepped instead of Heartbeat. Hearbeat runs after physics but before RenderStepped. You want to cap the framerate after your code is done running.

1 Like

Were do I find the zoom distance and what should I set it to. My game is a nostalgia game of ROBLOX in 2006? Do you know what to set to or what you recommend

Same code but replace it with RenderStepped?

I used a model to show my FPS and it aint working. Here is script


image

Are you making so that it automatically caps the fps? PlayerScripts does not have a MouseButton1Click event, just use this

local RunService = game:GetService("RunService")
local MaxFPS = 30
while true do
    local t0 = tick()
    RunService.RenderSteppedt:Wait()
    repeat until (t0 + 1/MaxFPS) < tick()
end

I put it? How do i know if it worsk or i gotta find out. Im really sorry for disturbing you.

Replace the code you have in the localscript with the code I sent, if you want to check if it works, you can set MaxFps to a low number such as 10 and if you get extreme choppiness, then it works.

Or how I did it was just to put the code, publish the game, go in game and do Shift + F5 and check my fps on the top left

I accidentally wrote RenderStepped as RenderSteppedt, my bad!

Just remove the t and you should be good

local RunService = game:GetService("RunService")
local MaxFPS = 10
while true do
    local t0 = tick()
    RunService.RenderStepped:Wait()
    repeat until (t0 + 1/MaxFPS) < tick()
end
3 Likes

I don’t think you should cap the framerate.

Instead; consider halting physics updates or maybe even the camera. But I wouldn’t suggest tampering with framerate as Roblox doesn’t have an actual built-in feature for that.

There’s good ways to get the old look that you would like to see, though.
I would consider making the camera (since it’s in legacy I would expect it to be in a Scriptable CameraType, too) update at most 30 times a second, this could recreate the 30 FPS expectation that you’re going for.

I wouldn’t suggest tampering, once again though.
It would be great to see roblox apply something like RunService:SetMaxRenderDelta() or anything of some sort to allow for FPS capping.