Help with first person arms script (R6)

Hello, I am making an fps game and want to implement a system where players can see their arms in first person and when the look up and down, their arms move with the camera. The closest I’ve gotten to this was a script that would move left and right as well. I’ve been trying to fix that but I either twist the joints in unrealistic ways or I’m greeted with a Vector3 error. I know theres a way as I’ve seen a game called Survival and kill the killers in area 51 do what I am trying to do. I’m a CFrame noob and have been stuck on this for a few weeks. I would greatly appreciate if you could help me!

My current script

local player = game.Players.LocalPlayer
local humanoid = script.Parent:WaitForChild('Humanoid')
local humanoidRootPart = script.Parent:WaitForChild('HumanoidRootPart')
local rightShoulder = script.Parent:WaitForChild('Torso'):WaitForChild('Right Shoulder')
local leftShoulder = script.Parent:WaitForChild('Torso'):WaitForChild('Left Shoulder')
local rightOrigin = rightShoulder.C0
local leftOrigin = leftShoulder.C0

game:GetService('RunService').RenderStepped:Connect(function()
	local cameraCFrame = game.Workspace.CurrentCamera.CFrame
	if script.Parent:WaitForChild('Head').LocalTransparencyModifier == 1 and humanoid.Health > 0 then
		rightShoulder.C0 = CFrame.new(rightOrigin.Position) * (cameraCFrame * CFrame.new(1, -1, -0.8)):ToObjectSpace(humanoidRootPart.CFrame):Inverse() * CFrame.Angles(0, 0, math.asin(cameraCFrame.Y))
		leftShoulder.C0 = CFrame.new(leftOrigin.Position) * (cameraCFrame * CFrame.new(-1, -1, -0.8)):ToObjectSpace(humanoidRootPart.CFrame):Inverse() * CFrame.Angles(0, 0, math.asin(cameraCFrame.Y))
	else
		rightShoulder.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi / 2, 0)
		leftShoulder.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi / 2, 0)
	end
end)

idk if this is what ur going for, but here:

hope this helps

2 Likes

Thank you for your reply, I’ve already done that part of the code. What I am trying to do is to make the arms follow the camera like a viewmodel

Oops, idk anything about that

Sorry, I think I am very stuck

Hopefully this fixes your issue :slight_smile:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local humanoid = script.Parent:WaitForChild(‘Humanoid’)
local humanoidRootPart = script.Parent:WaitForChild(‘HumanoidRootPart’)
local rightShoulder = script.Parent:WaitForChild(‘Torso’):WaitForChild(‘Right Shoulder’)
local leftShoulder = script.Parent:WaitForChild(‘Torso’):WaitForChild(‘Left Shoulder’)
local rightOrigin = rightShoulder.C0
local leftOrigin = leftShoulder.C0

game:GetService(‘RunService’).RenderStepped:Connect(function()
script.Parent:WaitForChild(‘Left Arm’).LocalTransparencyModifier = 0
script.Parent:WaitForChild(‘Right Arm’).LocalTransparencyModifier = 0
if script.Parent:WaitForChild(‘Head’).LocalTransparencyModifier == 1 and humanoid.Health > 0 then
rightShoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(-math.asin((mouse.Origin.p - mouse.Hit.p).unit.y),1.55,0, 0.5)

leftShoulder.C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(-math.asin((mouse.Origin.p - mouse.Hit.p).unit.y),-1.55,0, 0.5)
else
rightShoulder.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi / 2, 0)
leftShoulder.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi / 2, 0)
end
end)

i have done up and down between, but it does show the arms hopefully