I have replicated the head movement with the torso but the torso now rotates way to far how can I limit the rotation of the torso?
Here is the torso script:
game:GetService("RunService").RenderStepped:Connect(function()
local CameraDirection = Root.CFrame:toObjectSpace(Camera.CFrame).lookVector
if Waist then
Waist.C0 = CFNew(0, YOffset, 0) * CFAng(0, -asin(CameraDirection.x), 0) * CFAng(asin(CameraDirection.y), 0, 0)
end
end)
game.ReplicatedStorage.Look.OnClientEvent:Connect(function(otherPlayer, neckCFrame)
local Waist = otherPlayer.Character:FindFirstChild("Neck", true)
if Waist then
tweenService:Create(Waist, TweenInfo.new(.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {C0 = neckCFrame}):Play()
end
end)
while wait(1) do
game.ReplicatedStorage.Torso:FireServer(Waist.C0)
end
I used this video to make the script:Server Side Head/Camera Movement (R6/R15) - Roblox (Remote Events and Tweening) - YouTube