[URGENT] Players cannot turn on mobile AND PC

  1. What do you want to achieve? I want to have the ability to rotate my character

  2. What is the issue? The < and > keys do not work and apparently people on mobile cannot turn, its critical

  3. 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

EDIT: Script is shortened, thanks bendsspace

Thanks in advance

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.

2 Likes

This may be me being stupid, but I thought the . and , stopped working a while back as . became used for emotes.

You may be right, but I dont think that causes the problem if that doesnt affect rotation

No, but I USED to have a script that worked, but some guy deleted that one and took this one. He told me it was better though

So, I would get rid of the mouse lock?

Sorry about that, I wrote this while being stressed in studio. Building a house and then realizing it is uneven

I might feel stupid, but what is a spring?

Thank you for your help

1 Like

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

I found this:
Camera Alignment Keys WITHOUT Forking PlayerModule - Resources / Community Resources - DevForum | Roblox

(Module: Camera Alignment Keys - Roblox)

I guess hum = humanoid

So, I tried it, but it didnt work. Am I missing something?
Idk what these mean

Thanks for the help so far

Idk how this helps, I have a problem with moving the arrow keys, not with camera alignment

AFTER LOTS OF THINKING, I DECIDED TO USE ANOTHER SCRIPT THAT DOES NOT RUIN THE CONTROLS

thanks to those who tried

I think you missed the HumanoidRootPart…

What do you mean? there is a variable that points to the rootpart

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