OnMouseLook
The mouse moved while the cursor is down - the moves the game turns the view with.
Once a frame at most, the frame’s sum of the mouse’s raw moves: dx > 0 to the right, dy > 0 towards you. It comes
while the player looks around with the mouse (the cursor down; while it is up OnMouseMove tells the pointer’s place),
also while a camera of the script’s or the game mode’s holds the view - a script’s own camera can follow the mouse. The
game still turns the view with the moves unless the script holds the look (SetMouseLookCapture). Nothing comes while
the emote wheel, the chat box or the F9 window has the mouse. A callback that raises an error is switched off.
Syntax
Section titled “Syntax”function OnMouseLook(dx, dy) -- ...end| Parameter | Type | |
|---|---|---|
dx |
number | the moves to the right (negative to the left) |
dy |
number | the moves towards you (negative away from you) |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”local turned = 0function OnMouseLook(dx, dy) turned = turned + math.abs(dx) if turned > 5000 then SendServerEvent("looked_around", "") turned = 0 endendSee also
Section titled “See also”SetMouseLookCapture · SetCamera · OnMouseMove · the The game’s UI for a script group of the index
