Scripts work fine in studio but in game act sped up

Hello, i have a sprint script and a idle camera movement where in studio the settings work accordantly, but when i test in actual game the players walk speed tween to max speed gets increased and the Stamina bar goes down faster, and my idle breath moves 2x faster in game rather than studio, Any reason Why?
Studio

In Game

1 Like

Are you using task.wait() or wait() for each time the stamina bar drains? If so, then the cause is FPS/a FPS unlocker. Players with higher FPS run task.wait() or wait() faster/more often than those with lower FPS. Your Roblox Studio could be running at 60 FPS while in-game you’re using a FPS unlocker which makes it drain much faster. Other than this possibility, I don’t know why it could be doing that.

this is one of the scripts it doesnt use any

local lspeed = 0.01 
local function lerp(s,e,a) return s+(e-s)*a end
local ix = 0
local iy = 0
local pi,sin,pi2 = math.pi,math.sin,math.pi*2
local cam = workspace.CurrentCamera
local lsx,lx,lsy,ly = speedx/1000,x/1000,speedy/1000,y/1000

game:GetService("RunService"):BindToRenderStep("Swaying",201,function()
	if game.Players.LocalPlayer.Character:WaitForChild("Humanoid").MoveDirection.Magnitude == 0 then -- we are idle
	lsx=lerp(lsx,speedx/1000,lspeed)
	lx=lerp(lx,x/1000,lspeed)
	lsy=lerp(lsy,speedy/1000,lspeed)
	ly=lerp(ly,y/1000,lspeed)
	ix = (ix + lsx)%pi2
	iy = (iy + lsy)%pi2
		cam.CFrame = cam.CFrame * CFrame.Angles(sin(ix)*lx,sin(iy)*ly,0)
	end
end)```
1 Like

Oh, RenderStep means every time that things are being rendered meaning that this is FPS dependent as well. You should be able to fix this by using tweenservice to tween the camera instead

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