#fps arms and head not working

1 messages · Page 1 of 1 (latest)

boreal mist
#

so im trying to code it so no matter where you look the arms and the head will still follow the camera in first person like those roblox fps games but theres always "infinite yield possible on ("right shoulder")... heres the script: local character
local torso
local player

player = game.Players.LocalPlayer
character = player.Character
root = character:WaitForChild("HumanoidRootPart")
run = game:GetService("RunService")
cam = workspace.CurrentCamera
torso = character:FindFirstChild("Torso")
neck = torso:WaitForChild("Neck")
right = torso:WaitForChild('RightShoulder')
left = torso:WaitForChild('LeftShoulder')

y = neck.C0.Y
Z = right.C0.X

run.RenderStepped:Connect(function()
local camdirec = root.CFrame:ToObjectSpace(cam.CFrame).LookVector
if neck then
neck.C0 = CFrame.new(0,y,0) * CFrame.Angles(0,math.rad(180),0) * CFrame.Angles(0, -camdirec.X, 0) * CFrame.Angles(-camdirec.Y,0,0)
neck.C0 = neck.C0 * CFrame.Angles(math.rad(-90),0,0)

    right.C0 = CFrame.new(z,0.5,0) * CFrame.Angles(0,math.rad(180),0) * CFrame.Angles(0, -camdirec.X, 0) * CFrame.Angles(-camdirec.Y,0,0)
    right.C0 = right.C0 * CFrame.Angles(0,math.rad(-90),math.rad(-90)) + Vector3.new(1, -0.5)


    left.C0 = CFrame.new(z,0.5,0) * CFrame.Angles(0,math.rad(180),0) * CFrame.Angles(0, -camdirec.X, 0) * CFrame.Angles(-camdirec.Y,0,0)
    left.C0 = left.C0 * CFrame.Angles(0,math.rad(90),math.rad(90)) + Vector3.new(-1, -0.5)
    
    game:GetService("ReplicatedStorage").head:FireServer(neck.C0,right.C0,left.C0)
end

end)