How would I replicate Viewmodel movement to server?

Recently I found an issue with my gun system, the problem is that the viewmodel movement only plays on the Client and doesn’t replicate to server

Client Script

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
local ReplicatedStorage = game:GetService("ReplicatedStorage")

if not character:FindFirstChild("Torso") then
	error("Player's Humanoid is not an R6 rig.")
	return
end

local head = character:WaitForChild("Head")
local torso = character:FindFirstChild("Torso")
local leftArm = character:FindFirstChild("Left Arm")
local rightArm = character:FindFirstChild("Right Arm")

local neck = torso:FindFirstChild("Neck")
local leftShoulder = torso:FindFirstChild("Left Shoulder")
local rightShoulder = torso:FindFirstChild("Right Shoulder")

local defaultHeadC1 = neck.C1
local defaultLeftArmC1 = leftShoulder.C1
local defaultRightArmC1 = rightShoulder.C1

local defaultHeadC0 = neck.C0
local defaultLeftArmC0 = leftShoulder.C0
local defaultRightArmC0 = rightShoulder.C0

local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")

local spring = require(script.spring)

local mouseDeltaDivision = 200

local swayOffset = CFrame.new()
local movementOffset = CFrame.new()

local swaySpring = spring.create()
local movementSpring = spring.create()

local transparency = 0

local function setTransparency(part)
	if part and part:IsA("BasePart") and (part.Name=="Left Arm" or part.Name=="Right Arm") then
		part.LocalTransparencyModifier = transparency
		
		part:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function(property)    
			part.LocalTransparencyModifier = transparency
		end)
	end
end

local function inFirstPerson()
	local dist = (camera.CFrame.Position - (root.Position + Vector3.new(0,1.5,0))).Magnitude
	return dist < 1
end

local function getBobbing(addition,speed,modifier)
	return math.sin(tick()*addition*speed)*modifier
end

local function renderStepped(dt)
	local speed = 1.5 * (humanoid.WalkSpeed / 16)
	local modifier = 4
	
	local mouseDelta = userInputService:GetMouseDelta()
	local walkCycle = Vector3.new(getBobbing(10,speed,modifier),getBobbing(5,speed,modifier), 0) * dt
	
	swaySpring:shove(Vector3.new(mouseDelta.x / mouseDeltaDivision,mouseDelta.y / mouseDeltaDivision))	
	
	if script:GetAttribute("WalkCycle") == true then
		movementOffset = movementSpring:update(dt)
	else
		movementOffset = CFrame.new()
	end
	
	if script:GetAttribute("ViewmodelSway") == true then
		swayOffset = swaySpring:update(dt)
	else
		swayOffset = CFrame.new()
	end
	
	local movementCF = CFrame.new()
	movementCF = CFrame.new(movementOffset.y, movementOffset.x, movementOffset.z)

	if humanoid.MoveDirection.Magnitude > 0 then
		movementSpring:shove(walkCycle)
	else
		movementSpring:shove(Vector3.new())
	end
	
	if inFirstPerson() then
		transparency = script:GetAttribute("ArmTransparency")
		--[[
		local cf = CFrame.Angles(math.pi/2, 0, 0)
		local x, y, z = cf:ToEulerAnglesYXZ()
		local newCF = CFrame.Angles(x, y, z) 
		--]]
		
		local torsoX,torsoY,torsoZ = torso.CFrame:ToEulerAnglesYXZ()
		local cameraX, cameraY, _ = camera.CFrame:ToEulerAnglesYXZ()
		
		local viewmodelOffset = script:GetAttribute("ViewmodelOffset")
		
		local torsoRot = CFrame.Angles(0,torsoY,torsoZ)
		local cameraPos = CFrame.new(viewmodelOffset.X,viewmodelOffset.Y,-viewmodelOffset.Z)
		local cameraRot = CFrame.Angles(0, -cameraY, 0)
		local swayCF = CFrame.Angles(swayOffset.y, swayOffset.x, swayOffset.x/2)
		
		local camCF = camera.CFrame * cameraPos * cameraRot * torsoRot * swayCF * movementCF
		
		rightShoulder.C0 = torso.CFrame:inverse() * (camCF * CFrame.Angles(0,math.rad(90),0) * CFrame.new(0,-1,1))
		leftShoulder.C0 = torso.CFrame:inverse() * (camCF * CFrame.Angles(0,math.rad(-90),0) * CFrame.new(0,-1,1))
	else
		transparency = 0
		
		neck.C1 = defaultHeadC1
		leftShoulder.C1 = defaultLeftArmC1
		rightShoulder.C1 = defaultRightArmC1
		
		neck.C0 = defaultHeadC0
		leftShoulder.C0 = defaultLeftArmC0
		rightShoulder.C0 = defaultRightArmC0
	end
end

for _,v in pairs(character:GetChildren()) do
	setTransparency(v)
end



runService.RenderStepped:Connect(renderStepped)

It shouldnt replicate? Viewmodel isn’t even supposed to be on server. It’s client sided thing to see hands

Not like that, So in most games for their viewmodelds when you look up and down the arms follow the camera but it shows that on the Server and client, Im having trouble with replicating that to the server

Do you mean head and “spine” or actual arms? Cause arms will rotate relative to root part

The Y axis isn’t being replicated to the Viewmodel

you could WeldConstraint the viewmodel to root part and just angle the root part when player is looking up or down

Does the client have ownership of viewmodel?

Well it isnt a normal Viewmodel that you would attach to the character this one basically just puts a offset on the camera

Are you saying the one on server and the one on client are actually the same viewmodels???

No theirs no Physical like viewmodel model its just a script that simulates a ViewModel by modifying the camera

Maybe I could make a remote event and fire the Shoulder and neck attachments CFrame to the server?

Does the client have ownership of viewmodel?

I was talking about the viewmodel on server

No, bobbing, and etc CFrames is going to cause you massive lag

Yes, It is running on the Client by a local script in StarterPlayerScripts.

image

I’m not talking about first person viewmodel…
image

Im talking about this viewmodel

Oh that’s not the a ViewModel that is just the Character being shown on the Server.

Then why do you expect client-sided viewmodel to affect your real character hands???

No im trying to figure out how to fire Viewmodel Y coordinate positions to the Server

Your best shot to make characters hand look up or down is to make character lean on client and replicate it.

What do you mean by Lean on Client?