moonscript
Search…
moonscript
Main page
Setup moonscript
How to use moonscript
Documentation
Examples
API
Events
Functions
Objects
Powered By
GitBook
Events
Make sure to always return the event you are hooking, otherwise your script will throw an error!
Note: You can cancel packets by setting event.canceled to true!
eventTick
This event will be called every tick.
eventMotion
This event will be called before the player movement is being handled.
Field
Object
Description
x
Number
Pos x of the player
y
Number
Pos y of the player
z
Number
Pos z of the player
Changes on these fields automatically apply.
eventCamera
This event will be called before the screen will be rendered.
Field
Object
Description
partialTicks
Number
The delta between the last render tick.
Changes on these fields automatically apply.
eventOverlay
This event will be called before the HUD is being rendered.
Field
Object
Description
resolution
Resolution
Resolution object, information about it can be found in the objects tab
Changes on these fields automatically apply.
eventPostUpdate
This event will be called after all position packets are sent.
eventPreUpdate
This event will be called before all position packets are sent.
Field
Object
Description
onGround
Boolean
Ground state
yaw
Number
Player pitch
pitch
Number
Player yaw
y
Number
Pos y
Changes on these fields automatically apply.
eventBlur
Getting called before the blur, everything that is being drawn in here is being blurred.
Field
Object
Description
shadow
Boolean
If you dont want a shadow to be drawn even if you have the module enabled check if this is false before you draw anything
eventPacketSend
Gets called before any packet is sent to the server.
Field
Object
Description
packet
Packet
Packet being sent to the server
Changes on the packet field automatically apply on the packets being sent to the server.
eventPacketReceive
Gets called before received packets are handled on the clientside.
Field
Object
Description
packetId
Number
ID of the packet being sent, if the scripting system doesnt know the packet it will be set to the signed integer limit (2,147,483,647)
eventVelocity
Gets called when the player is receiving velocity. If you divide the motions by 100 you get the correct motion value!
Field
Object
Description
x
Number
Motion x of the packet
y
Number
Motion y of the packet
z
Number
Motion z of the packet
eventSetback
Gets called when the player is receiving a rotation packet from the server. This event CAN NOT be canceled!
onEnable
This event will be called after your module was enabled.
onDisable
This event will be called after your module was disabled.
How to hook events?
Hooking events is really easy, you can find an example below!
Examples
Previous
Spinbot
Next - API
Functions
Last modified
5mo ago
Copy link
Contents
eventTick
eventMotion
eventCamera
eventOverlay
eventPostUpdate
eventPreUpdate
eventBlur
eventPacketSend
eventPacketReceive
eventVelocity
eventSetback
onEnable
onDisable
How to hook events?