This is my script. It’s used on a local script. It works on client side but not the server side(Because it’s a local script) and I want to know how to make it work on the server side. If you know how to add it, please tell me! Thanks.
local camera = workspace.CurrentCamera
local char = game.Players.LocalPlayer.Character
local root = char:WaitForChild("HumanoidRootPart")
local Neck = char:FindFirstChild("Neck", true)
local YOffset = Neck.C0.Y
local CFNew, CFAng, asin = CFrame.new, CFrame.Angles, math.asin
game:GetService("RunService").RenderStepped:Connect(function()
local CameraDirection = root.CFrame:ToObjectSpace(camera.CFrame).LookVector
if Neck then
Neck.C0 = CFNew(0, YOffset, 0) * CFrame.Angles(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -math.asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)
end
end)