Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a more efficient way to make the server know a players mouse properties?

Asked by 5 years ago

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.

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 Impacthills 223 — 5y
0
That made it less laggy but its still a bit laggy. goldstorm950 65 — 5y
0
Good enough I guess goldstorm950 65 — 5y
0
If its choppy on the rotation try RenderStepped Impacthills 223 — 5y
0
Could the server get the mouse itself? I've heard people doing that before. Creeperman1524 120 — 5y

Answer this question