I’ve a script from a previous post which will make the character turn in the direction of the mouse:
function CameraHandler.SnapDirection()
if not look then return end
local IX, IY = InputInformation.IX, InputInformation.IY
local mp = Vector2.new(IX, IY)
local center = Camera.ViewportSize / 2
local r = (mp - center)
if r.x > 0 then
if Dir == 1 then return end
Dir = 1 --Right
CF = CFrame.new(0, -1, 0) * CFrame.Angles(0,math.rad(0) ,0)
elseif r.x < 0 then
if Dir == -1 then return end
Dir = -1 --Left
CF = CFrame.new(0, -1, 0) * CFrame.Angles(0,math.rad(180) ,0)
end
end
The function is fired on InputChanged and a remote event is fired with the “CF” Arguement then the root.c0 is changed on the server. It works fine when the player is already oriented to the left, however, The CFrame is offset by 180 degrees as oppose to SET to 180 degrees
https://gyazo.com/ab79b4bfd38c414a96d082b554b9499b
https://gyazo.com/d3d6d4bacc63e1a2d9a2d0645f1e38d5
I’m really confused by this, Any help would be greatly appreciated