What i'm trying to make is a script that works kinda like jailbreak and meepcity where your play looks towards your camera. I have something that kinda works, but i feel like it isn't a good way to do it, and theres some bugs. The bugs are that when your walking and you right click to look, the players body moves too and then kinda just breaks, this also happens when you move the camera really fast. Here's the place in case my explanation wasn't good, Here I did not code this myself, i'm not very good at math, especially when it comes to Calculus and Trigonometry (If that's whats used here), so an explanation on maybe on what Asin and the other functions kind of do.

Here is the code.

Client

    local remoteEvents = game.ReplicatedStorage:WaitForChild("RemoteEvents");

local camera = game.Workspace.CurrentCamera

local walking = false

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:wait()



  

  

  

game:GetService("RunService").RenderStepped:Connect(function()

remoteEvents.tiltAt:FireServer(math.asin(camera.CFrame.LookVector.y),math.asin(camera.CFrame.LookVector.x));

end)

Server

local remoteEvents = game.ReplicatedStorage:WaitForChild("RemoteEvents");



local neckC0 = CFrame.new(0, 0.8, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);

local waistC0 = CFrame.new(0, 0.2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);

  

remoteEvents.tiltAt.OnServerEvent:Connect(function(player, theta, theta2)

local neck = player.Character.Head.Neck;

local waist = player.Character.UpperTorso.Waist;

local lowerWaist = player.Character.LowerTorso.Root;

  

neck.C0 = neckC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, theta2*-0.4, 0);

waist.C0 = waistC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, theta2*-0.4, 0);

end)