How to make character turn speed lower & add a speed cap to the turn speed

  1. What do you want to achieve?

Im trying to make a ram move which you can hold to gain speed, and while this move is active, your turn speed needs to be lower.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

The current solution i have is while skill is hold down, i change the users mouse delta sensitivity and it slows down ur turning, but the user can easily bypass this by simple raising their mouse sensitivity, or raising their Camera Sensitivity from the settings.

Yes i have looked almost through all related dev forum posts but to no avail.

This is a video that shows both examples of low and high sensitivity:

External Media
1 Like

I think a common solution to something like this is making the character maybe turning slower towards the direction the camera is facing so actually turning the camera itself doesnt slow down only character rotation, but I don’t know.

From a quick look in the PlayerScripts it looks like the camera cframe is updated line 517 in “CameraModule” function CameraModule:Update(dt) --505 function currentCamera.CFrame = newCameraCFrame --517 the workspace.currentcamera set to a new cframe so maybe if you store the old orientation in a variable or the orientation 100ms ago or something such, then you can say the camera cframe cant be x more than the old cframe or you will set the new cframe to the old cframe + the limit you can turn at.
If you continue to use what you use now as a base for most players, then also having the check that the new cframe isnt more than the limit as a backup since I think it could be difficult to make it look smooth, then perhaps it could make a good result.

Other than this I can’t think of any other way than making your own camera script or such, which doesn’t sound like a good idea or any fun

1 Like

You’ve left me confused, what exactly is ur idea? make the character turn slower or apply a limit to the camera cframe?

I would probably keep this and then add a limit in the camera module aswell as a patch to players currently bypassing by increasing sensitivity

And how exactly would i limit it

I got a really messy module script that atleast stops the player from turning too far


local LIMIT = 500

local cam = game:GetService("Workspace").CurrentCamera

local last_cf = 0
local last_call = 0

local m = {}

local function AlwaysPositive(num) --dunno if theres a premade function for this or smt
	if(num<0) then
		return num-(num*2)
	end
	return num
end

local function DegreeMath(one,two)
	if(one>150 and two<-150) then --If they spin REALLY fast this could be a problem idrk tbh
		return (180-one)+(two+180)
	elseif(one<-150 and two>150) then
		return (one+180)+(180-two)
	end
	return AlwaysPositive(one-two)
end

function m:LimitTurnSpeed(new_cf)
	local now = os.clock()
	local offline = now-last_call
	last_call = now
	local limit = offline*LIMIT
	local _,ori = new_cf:ToOrientation()
	local rot = math.deg(ori)
	local speed = DegreeMath(rot,last_cf)
	if(speed>limit) then
		warn("TOO FAST! "..speed,limit) --Del me after testing (:
		local ncf = CFrame.new(new_cf.Position) * CFrame.fromEulerAngles(0,math.rad(last_cf),0)
		return ncf
	end
	warn("Turning is okay! "..speed,limit) --Del me after testing (:
	last_cf = rot
	return false
end

return m

Basically I just call function m:LimitTurnSpeed(new_cf) before setting the new camera cframe in the camera module, this will calculate “speed” which is how far the player’s camera turned and if it is more than the number calculated based on the time since last check and LIMITER, then the camera will go back to last time it was at an acceptable speed.
The script is very messy and only tested a few times but seems to atleast stop bypassers of your script slowing their sens down. You can adjust LIMITER more or less regardning how fast the players should be allowed to turn
The camera module:

local currentCamera = game.Workspace.CurrentCamera :: Camera
local ncf = TURN_SPEED_LIMITER:LimitTurnSpeed(newCameraCFrame)
if(ncf) then
	currentCamera.CFrame = ncf
else
	currentCamera.CFrame = newCameraCFrame
end
currentCamera.Focus = newCameraFocus

I started messing with turning the camera as far as possible considering the limiter but it became is mess really fast so I didn’t bother doing more with that myself.
Also I don’t really know why it’s moving the camera but a player that isn’t trying to bypass the sens change wouldn’t see the effects of this script anyways so the only possible issue I see with this is if the players can gain an advantage with moving the camera intentionally…