Note: this is different from how to set the players rotation speed
Hey guys
I believe the title says it all. Anyway to change the speed at which the player turns (or strafes)? Ex. when I press A or D the player turns very quickly. I could have used UIS to reduce the player walkspeed when they press A or D but I dont want to reduce the speed at which they go ahead. Maybe I should add vector forces on the sides and use a script to activate them or smth? I havent tried anything and searching didnt help. Help would be appreciated.
do you mean, slowing player rotation?
Nope, its different. I am using AutoRotateEnabled
false on the player humanoid, so i dont need rotation thingy. Please read the note before answering. Also I want to slower the speed at which they turn when they press A or D not the rotation
I thought so, i got confused since you want to slow the speed “turning?” when they press A or D
Yeah yeah, its also known as strafing, like when u press A or D the speed u turn left or right (not rotate) is equal to ur walkspeed, idk how to lower the strafe speed.
you said that “AutoRotateEnabled” is false,
I think you have some script that edit some turning when they press A or D; if so you can probably edit that number (dont know about autorotateenabled other than that i think it’s Humanoid.AutoRotate = false)
I dont have a script which sets the turning thing. AutoRotateEnabled just rotates the character when u turn, if its false then also the character will turn it just wont rotate.
anyone here to help please
If I understand correctly, you want to slow down players speed while pressing A or D.
You can use ContextActionService:BindActionAtPriority()
and setting that priorty to Enum.ContextActionPriority.Low.Value
. Because when you bind an action that requires A or D keys to be pressed, it sinks user input.
And here is your code, it requires to be used in LocalScript
, and place that script in StarterPlayer > StarterPlayerScripts
:
local contextActionService = game:GetService("ContextActionService")
local character = game.Players.LocalPlayer.CharacterAdded:Wait()
function reduceSpeed(actionName, inputState, inputObject)
if actionName == "reduceStrafeSpeed" then --Checking action name
if inputState == Enum.UserInputState.Begin then --Checking if key is pressed
character.Humanoid.WalkSpeed = 10 --Set player speed to 10 studs per second while strafing
else
character.Humanoid.WalkSpeed = 16
end
end
end
contextActionService:BindActionAtPriority("reduceStrafeSpeed",reduceSpeed,false,Enum.ContextActionPriority.Low.Value,Enum.KeyCode.A,Enum.KeyCode.D)
Node: This code only works on keyboards, so if you want to add mobile compatibility, you need to tweak this code.
This is exactly what I not want. If I slow down the walkspeed the player will move slowly towards the front also. I want to reduce the “turn speed”, not the walkspeed.
I already mentioned I did not want it.
I found this post:
Basically there is rotation speed configuration, but I hope this post helps you.
I have browsed through every post regarding this, including that. Its just completely different then what I want.
Could try disabling autoRotate and using UserInputService along with tweening CFrame to make your own turning.