Character arms follow camera

Hello,

I’m trying to utilize the roblox character arms/motor6d as my first person arms. I’ve seen this asked many times but I haven’t seen it answered. I’ve always used viewmodels but for this project I’m trying to do something a little different. My goal is not to have the most amazing looking player models, but accurate as to what everyone else is seeing. I’ve tried quite a few things already but haven’t been able to get it accurate. Looking for some answers on here, or help in the right direction. The goal is to have the arms rotate with the cameras y axis, as I believe its the only axis that will matter in first person since the other axis are taken care of.

4 Likes

bump, this is almost the required amount of letters.

2 Likes

Try this code, it changes the motor6d’s c0 and c1 according to the camera’s Y axis. Before hand you have to put a remote event in the replicated storage and call it whatever.

Local Script:

local remoteEvent = game.ReplicatedStorage.RemoteEvent
game:GetService("RunService").RenderStepped:Connect(function()
   remoteEvent:FireServer(workspace.currentcamera.cframe)
end)

Global Script(put in server script service,this part is adapted from GuestCapone’s thing i found from the toolbox, converted to server script):

--THIS MIGHT NOT BE THE BEST SOLUTION (but it works :D)

game.Players.PlayerAdded:Connect(function(plr)			
	plr.CharacterAdded:Connect(function(char)		
		local i = 0
		local NeckC0
		local NeckC1
		game.ReplicatedStorage.Events.tiltChar.OnServerEvent:Connect(function(plr,cf)
			local char = plr.Character
			--cf is the camera's cframe
			
			local torso = char:WaitForChild("Torso")
			local Neck = torso:WaitForChild("Neck")
			local LeftShoulder = torso:WaitForChild("Left Shoulder")
			local RightShoulder = torso:WaitForChild("Right Shoulder")
			local Weapon = torso:WaitForChild("ToolGrip")
			local Humanoid = char:WaitForChild("Humanoid")
			
			local riseMagnitude = 0.9
			local RC1 = CFrame.new(1, .5, 0, 0, 0, riseMagnitude, 0, riseMagnitude, 0, -riseMagnitude, 0, 0)
			local LC1 = CFrame.new(-1, .5, 0, 0, 0, -riseMagnitude, 0, riseMagnitude, 0, riseMagnitude, 0, 0)
			
			if i == 0 then -- delete this and head will spin crazy
				NeckC0 = Neck.C0
				NeckC1 = Neck.C1
				i = 1
			end
			
			local offset = CFrame.Angles(0,0,cf.lookVector.Y)
			local tool = char:FindFirstChildOfClass("Tool")
			
			if tool then --arm follow camera when tool equipped
				RightShoulder.C0 = RC1 * offset
				LeftShoulder.C0 = LC1 * offset:inverse()
				Weapon.C0 = CFrame.Angles(cf.lookVector.y,0,0)
			else
				RightShoulder.C0 = RC1 * CFrame.Angles(0,0,0)
				LeftShoulder.C0 = LC1 * CFrame.Angles(0,0,0)
			end
			Neck.C0 = NeckC0 * CFrame.Angles(cf.lookVector.y, 0, 0):inverse()
		end)
	end)
end)
8 Likes

it no work it now work it now work

How do I make it so that it moves the head and arms all the time, regardless of a tool being equipped?

i have found that easy first person is what i need.
it uses your normal character arms and turns it into a Viewmodel for First Person.
it plays the animations as well.

here is model link: EasyFirstPerson - drag and drop viewmodels! - Roblox