Fireserver error and player tilt function issues

Hello I need some help the fire server is not working! It shows me the prints on the server but the lean function doesn’t work! and you can’t see it on the server either (the player lean function), what’s wrong? I’ve been with this for 3 days and nobody helps me. :confused:

image

image

client side:

local function playerLookUpDown(active)
	if active == true then
		print('its active!')
		
		-- get useful motor6ds
		local root = motors["RootJoint"]
		local leftHip = motors["LeftHip"]
		local rightHip = motors["RightHip"]
		-- get angles of camera
		local y, x, z = camera.CFrame:ToEulerAnglesYXZ()
		local groundOffset = math.abs(0.5 * torso.Size.Y - 0.5 * torso.Size.Z) * math.abs(math.sin(y))
		-- rotate motor6ds
		root[1].C0 = root[2] * CFrame.fromEulerAnglesYXZ(-y, 0, 0) * CFrame.new(0, 0, -groundOffset)
		leftHip[1].C0 = leftHip[2] * CFrame.fromEulerAnglesYXZ(0, 0, y)
		rightHip[1].C0 = rightHip[2] * CFrame.fromEulerAnglesYXZ(0, 0, -y)
	elseif active == false then
		print('its not activated')
	end
end

-- connections
local connection = RunService:BindToRenderStep("updateMotors", Enum.RenderPriority.Character.Value, playerLookUpDown)

uis.InputBegan:Connect(function(input)
	
	-- Activate camera buttons
	if input.KeyCode == Enum.KeyCode.T and isClassicCamera == true then
		print('Classic Mode Activated')
		-- do something
		ZoomOut(minZoomAttribute_FPS, maxZoomAttribute_FPS) -- 10, 70
		removeLimitCameraUpDown()
		
		uis.MouseIconEnabled = true
		isClassicCamera = false
		
	elseif input.KeyCode == Enum.KeyCode.T and isClassicCamera == false then
		print('FPS Mode Activated')
		-- do something
		player.CameraMode = Enum.CameraMode.LockFirstPerson
		player.Character.Humanoid.CameraOffset = Vector3.new(0, -0.4, -0.2)
		uis.MouseIconEnabled = false
		
		limitCameraUpDown(minCameraAttribute_FPS, maxCameraAttribute_FPS) -- -34, 150
		
		if isClassicCamera == false then
			for _,v in pairs(character:GetChildren()) do
				antiTrans(v, true)
			end
		end
		
		lookDownEvent:FireServer(connection)
		
		isClassicCamera = true
	end
	
	-- Run animation play
	if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.D then
		runAnimationTrack:Play()
		runAnimEvent:FireServer()
	end
end)

server side:


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local runAnimEvent = ReplicatedStorage:WaitForChild("PlayRunAnim")
local lookDownEvent = ReplicatedStorage:WaitForChild("lookDownEvent")

local players = game:GetService("Players")
local player = players.LocalPlayer



runAnimEvent.OnServerEvent:Connect(function()
	print('Connected to server!')
end)

lookDownEvent.OnServerEvent:Connect(function(connection)
	print('Connected to server!')
	print('look down works')
end)

When you fire the server from the client through a local script, the player object pertaining to the client (the local player) is automatically passed as an argument to the “FireServer” function call, meaning that when the “OnServerEvent” events listen for a “FireServer” call, any function connected to the OnServerEvent through the “:Connect()” function is passed this player object as an argument and thus a parameter must be setup to handle this additional value.

In the current state, the function connected to the first OnServerEvent event likely works, since nothing is required, however in the function connected to the second OnServerEvent, the received parameter named “connection” is passed the player object and not the connection value you intended to pass.

runAnimEvent.OnServerEvent:Connect(function(player)
	print('Connected to server!')
end)

lookDownEvent.OnServerEvent:Connect(function(player, connection)
	print('Connected to server!')
	print('look down works')
end)

Try the above, if any issues/errors are still occurring then it is likely due to some other problem in your script.