YOU DONT GOTTA READ THE CODE JUST READ THE QUESTION.

Server Side:

game.Players.PlayerAdded:Connect(function(player)
	local MO = nil
	Events.MousePos.OnServerEvent:Connect(function(player, mo)
		MO = mo
	end)
	while player.Parent do
		local Kek = CFrame.Angles(0, 0, math.asin(MO))
	end
end)

Client Side:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
while true do
	game.ReplicatedStorage.Events.MousePos:FireServer(Mouse.Origin.lookVector.Y)
	wait()
end

In order to do a set of code I have to use Server Script so that other players can see it obviously. And the script requires some properties of the players mouse. Soooo I constantly send it a property of the mouse with a RemoteEvent, however when I test the game, it's laggy.

Is there a more efficient way to get a server script to know the properties of the players mouse, cause it would 100% solve all my problems.

5 comments

0

To make it less laggy you could only fire the event when the mouse is actually moved. Also you should wait() inside that while loop on like 6

0

That made it less laggy but its still a bit laggy.

0

Good enough I guess

0

If its choppy on the rotation try RenderStepped

0

Could the server get the mouse itself? I've heard people doing that before.