On a LocalScript, create a Part, set the size to Vector3.new(2,1,1) and then set the Part1 on Both Shoulder Motor Joint to it. And then, you can just go about making it face the Camera in the X axis (rotation by the way)
Example Code,
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Camera = workspace.CurrentCamera
local Root = Character.HumanoidRootPart
local Torso = Character.Torso
local RunService = game:GetService("RunService")
--[[ Setting Up Viewmodel ]]--
local FakeTorso = Instance.new("Part", Camera)
FakeTorso.Size = Vector3.new(2,1,1)
FakeTorso.Name = "Torso"
FakeTorso.Anchored = true
FakeTorso.CanCollide = false
FakeTorso.Transparency = 1
--[[ Setting Up Joints ]]--
local LeftS = Torso["Left Shoulder"]
LeftS.Part0 = FakeTorso
LeftS.C1 *= CFrame.new(0,0.5,0)
local RightS = Torso["Right Shoulder"]
RightS.Part0 = FakeTorso
RightS.C1 *= CFrame.new(0,0.5,0)
--[[ Main ]]--
RunService.RenderStepped:Connect(function()
local CameraPitch,_,_ = Camera.CFrame:ToOrientation()
FakeTorso.CFrame = (Torso.CFrame * CFrame.new(0,0.5,0)) * CFrame.Angles(CameraPitch,0,0)
end)
Also ermm, please note that this code have some flaws. Since the Arms position will be related to the Torso instead of the Camera, it might show some weird result when you look up and down. Now, this is an simple fix.
First Option to fix this is to tweak the script and make the FakeTorso.CFrame set to the Camera.CFrame every renderstepped.
Second Option, if done right it could make it more realistic and it’ll also be easier to replicate the Rotation on Server. You can do this by making the Humanoid.CameraOffset depend on the CameraPitch.
Example Code: (you can put this into the RenderStepped on the main script i gave)
local Humanoid = Character.Humanoid
Humanoid.CameraOffset = Humanoid.CameraOffset:Lerp(Vector3.new(0,0,CameraPitch),0.1)
I haven’t tested this, it might be reversed and to fix that you just simply have to make the CameraPitch negative in the Lerp Section. -CameraPitch instead of CameraPitch.
And one more thing, you need to make both arm visible when in first person since i didn’t do that lol… Anyways, this works for Both Third and First Person.
And yes, this will replicate the Character Animation and also the Tool the Player is Holding. Since, it still uses the Left Arm and Right Arm that’s already in the Character.
Now, combine all those together and this will be the result