What do you want to achieve? I want to have the ability to rotate my character
What is the issue? The < and > keys do not work and apparently people on mobile cannot turn, its critical
What solutions have you tried so far? Other topics could not help
input.InputChanged:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness
local X = TargetAngleX - delta.y
TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X
TargetAngleY = (TargetAngleY - delta.x) %360
end
end)
I put the full script I think is causing the problem, if there is a part of the script that surely is not the problem, then I will remove it
Did this ever work? You set the camera to scriptable and
don’t have any connection to the arrow keys to manually move the camera.
don’t set the camera back to Custom
I believe your problem is just this segment:
input.InputChanged:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness
local X = TargetAngleX - delta.y
TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X
TargetAngleY = (TargetAngleY - delta.x) %360
end
end)
This is the only thing that rotates the camera if I understand the code correctly, and this is based only on the mouse moving. That means it might not work on mobile and definitely won’t work with the arrow keys. It also might not work when the mouse is locked.
Why is this urgent BTW? It doesn’t seem very urgent, this code very likely never worked.
Edit:
Your spring is also FPS dependent, that’s probably fine though if it moves faster for some people.
This code will rotate the player character, make sure the humanoid AutoRotate is off or else it not gonna work.
hum.AutoRotate = false
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ() --Get the angles of the camera
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0) --Set the root part to the camera's rotation