I’m trying to make a system where whenever a player is under water, their rotation matches their camera rotation. Only issue right now is it’s multiplying the current CFrame by the camera angle CFrame, and I’m not sure how to make it so it just simply matches the camera rotation.
-- First, turn off auto rotate in the humanoid (I'm assuming you can get a reference to this since you have the root)
humanoid.AutoRotate = false
-- Then setup a function that constantly sets the camera rotation
RunService:BindToRenderStep("LockRotationToCamera", Enum.RenderPriority.Character.Value, function()
-- Lock the mouse to the center
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
-- Get the camera rotation as Euler angles, then we'll just use the y
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ()
-- Set the root's frame to its position and the cameras rotation
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0)
end)