Made these scripts for player's arms to follow player's cursor's Y angle. However, when sending mouse's position from client to server and then applying it to player's Motor6Ds makes it very choppy. I think I should use CFrame:lerp, and I tried but I still couldn't manage to make it work.

Local script:

local player=game.Players.LocalPlayer
local mouse=player:GetMouse()

mouse.Move:Connect(function()
	local argument=CFrame.Angles(math.asin((mouse.Hit.p-mouse.Origin.p).unit.y),0,0)
	game.ReplicatedStorage.RemoteEvent:FireServer('Arms',argument)
end)

Server script:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,variant,argument)
	if argument=='Arms'then
		player.Character.RightLowerArm.RightElbow.C0=CFrame.new(0,-.2,0)*argument
		player.Character.LeftLowerArm.LeftElbow.C0=CFrame.new(0,-.2,0)*argument
	end
end)

Thank you for your time.

2 comments

1

Why not do it on the client instantly, and then replicate it to the rest of the clients?

0

Thank you for putting me on the right way. I got it to work perfectly! <3