Updating player rotation on the server

image

From what I can find online, a remote event can be fired a maximum of 20 times a second.

RS.RenderStepped:Connect(function()
	if LookAtMouse then
		local MousePosition = mouse.Hit.Position
		Character.HumanoidRootPart.CFrame = CFrame.lookAt(Character.HumanoidRootPart.Position, MousePosition)
	end
end)

This script above will update the player’s rotation from a local script, which doesn’t update the rotation on anyone else’s screen. A remote event could be used, but it would only update the player’s rotation a maximum of 20 times a second.

The first idea that comes to mind is to use multiple remote events. For example:

Remote1:FireServer(information)
task.wait(0.05)
Remote2:FireServer(information)
task.wait(0.05)

This would require 3 remote events to update 60 times a second, and every player would have to have their own 3 remote events. However, there would have to be a server script to detect every single one of these 3 events for each player in the game, which (more than likely) isn’t the most efficient way to solve this issue

You can fire a remote event every frame.

Well yes, but like I stated. Remote events can only be fired a maximum of 20 times a second. A player will normally on a low-mid end computer be able to hold somewhere around 60 frames.

In the age of task.wait RemoteEvents can be fired more than 20 times per second, perform a benchmark and see.

Not sure why it says online that it can only be fired 20 times a second, I just tested it in game and you’re absolutely right. The post I’m referencing was August 30th, 2021. Studio could have changed the limit since then?

It’s more now because of the addition of the task library which in the backend increased the amount of times .RenderStepped was fired.

1 Like