The rnet library provides a simple interface for raknet shenanigans.
NOTE: This is an unofficial documentation of the rnet library, and not all the functions are listed here. I didn't document the experimental (or not working) functions from here.
Also I used UNC's docs format because I can't design my own 🧌
All of the functions/methods here had a camelCase equivalent alias I think??
- rnet.fireevent
- rnet.getevents
- rnet.getproperties
- rnet.fireremote
- rnet.setfilter
- rnet.blockdeletes
- rnet.blockcreates
- rnet.nextpacket
- rnet.readeventpacket
- rnet.sendphysics
- rnet.setparent
- rnet.setproperty
- rnet.sit
- rnet.equiptool
- rnet.unequiptool
- rnet.touch
- rnet.destroy
- rnet.disconnect
- rnet.setphysicsrootpart
- rnet.send
function rnet.fireevent(instance: Instance, eventName: string, ...any)
fires the eventName
of instance
with any provided args, equivalent to synapse/sw firesignal.
instance
- the instance to use duheventName
- theinstance
's event to fire
local player = game:GetService("Players").LocalPlayer
local backpack = player.Backpack
local character = player.Character
rnet.fireevent(character.Humanoid, "ServerEquipTool", backpack:GetChildren()[1]) -- equips the first tool in your backpack in server?
function rnet.getevents(instance: Instance): array
returns a table of event names/info for the instance.
instance
- the instance to use duh
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local eventNames = rnet.getevents(character.Humanoid) -- list of events here
table.foreach(eventNames, print) -- and we print it here
function rnet.getproperties(instance: Instance): array
returns a table of hidden properties for the instance.
instance
- the instance to use duh
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local hiddenProperties = rnet.getproperties(character.Humanoid) -- list of hidden properties here
table.foreach(hiddenProperties, print) -- and we print it here
function rnet.fireremote(remote: RemoteEvent | RemoteFunction, count: number, ...)
fires the remote
with the given args count
number of times.
remote
- the remote to firecount
- number of times the the remote will be fired
-- this spams "message" 5 times
local remote = game:GetService("ReplicatedStorage").DefaultMakeChatSystemEvents.SayMessageRequest
rnet.fireremote(remote, 5, "message", "All")
function rnet.setfilter(filteringPacketIds: array)
filters a certain packet ID and/or sub-id, preventing your client from sending packets if it starts with that.
filteringPacketIds
- array of packet list to filter
rnet.setfilter({0x2, 0x65, 0x108, 0x69}) -- this is just random nonsense, but it shows the point that an array table should be used
function rnet.blockdeletes(arg1: boolean)
filters the "ID_DELETE_INSTANCE"
packets if arg1
is true.
arg1
- states whether to filter the"ID_DELETE_INSTANCE"
packets.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
rnet.blockdeletes(true) -- anything that the client has deleted will not be sended in the server
character["Left Leg"]:Destroy()
function rnet.blockcreates(arg1: boolean)
filters the "ID_NEW_INSTANCE"
packets if arg1
is true, only blocks the RightGrip creation (for now?).
arg1
- states whether to filter the"ID_NEW_INSTANCE"
packets.
rnet.blockcreates(true) -- enables it (can't provide a useful explanation rn)
function rnet.nextpacket(): string
gets the latest packet that the client has sent to server.
none.
-- just goto the rnet.readeventpacket example
🪲 Inconsistent
function rnet.readeventpacket(packet: string): dictionary
decodes the provided packet
and returns the event info of the packet, useful for packet event spying.
Field | Type | Description |
---|---|---|
source |
Instance | The instance that the event used. |
name |
string | The event name used on instance . |
arguments |
array | The event arguments. |
packet
- the packet to decode.
-- provided by woody, and I modified it
local packetNumber = 0
while true do task.wait()
local packetData = rnet.nextpacket() -- we get the packet data
if (packet.id == 0x83 and packet.subid == 0x7) then -- this id with this sub-id indicates an "event" packet
pcall(function() -- pcall?
local packetInfo = rnet.readeventpacket(packetData) -- we decode the packet
print(string.format("Packet Number #%d:\n Event used [%s] on instance %s", packetNumber, packetInfo.name, packetInfo.instance:GetFullName())) -- and we print it to the console
end)
end
packetNumber += 1
end
function rnet.sendphysics(position: CFrame)
sends new physics packets (as CFrame) for the character to other clients.
position
- the position to send for the character.
local position = Vector3.new(0, -69420, 0)
while true do task.wait()
-- teleports the character to (0, -69420, 0), making you invisible to other players
rnet.sendphysics(CFrame.identity + (position or Vector3.zero))
end
function rnet.setparent(instance: Instance, newParent: Instance)
sets the instance
parent to newParent
, self explanatory wise man said.
instance
- the instance that will be parented bynewParent
.newParent
- theinstance
's new parent.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
rnet.setparent(humanoid, workspace) -- sets the parent of humanoid to workspace, idk if it works but this is just an example
function rnet.setproperty(instance: Instance, propertyName: string, value: any)
sets the instance
property propertyName
to value
, only works on hidden properties.
instance
- the instance that will be modified.propertyName
- theinstance
's property, must be hidden property.value
- the value to be set forpropertyName
ofinstance
.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
rnet.setproperty(humanoid, "AHiddenProperty", true) -- sets the humanoid's "AHiddenProperty" property to true, doesn't work because this is just an example.
function rnet.sit(seat: SeatPart, humanoid: Humanoid)
sits the character to seat
, manually creates a weld on server.
seat
- the SeatPart that theplrHumanoid
will seat to.humanoid
- the target player's humanoid to seat.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local seat = workspace.SeatPart
rnet.sit(seat, character.Humanoid) -- sits the player to seat
function rnet.equiptool(tool: Tool, weld: Weld?, alsoUnequip: boolean?)
equips the tool
to the character.
tool
- the tool that will be equipped by character.weld
- the custom weld (optional).alsoUnequip
- if the character should also unequip thetool
(optional).
local player = game:GetService("Players").LocalPlayer
local backpack = player.Backpack
rnet.equiptool(backpack:GetChildren()[1]) -- we equip the tool that is in the backpack
function rnet.unequiptool(tool: Tool)
unequips the tool
in the character.
tool
- the tool that will be unequipped to character.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
rnet.unequiptool(character:FindFirstChildOfClass("Tool")) -- we unequip the tool that is equipped by the player
function rnet.touch(part1: BasePart, part2: BasePart)
simulates a touch between part1
and part2
.
part1
- part that will be touched bypart2
.part2
- part that will touch thepart1
.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local killbrick = workspace.KillBrick
rnet.touch(killbrick, character.HumanoidRootPart) -- the rootpart of character touched the killbrick, as a result the character will die
function rnet.destroy(instance: Instance)
sends a "DELETE_INSTANCE"
packet to possibly destroy instance.
instance
- instance that will be destroyed.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
rnet.destroy(character.Torso.Neck) -- we destroy the neck weld of the character, possibly kills the character?
function rnet.disconnect()
destroys the client's replicator, disconnecting you on server.
none.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
-- disconnects your client when u die, possibly a good punishment when dying
character.Humanoid.Died:Connect(function()
rnet.disconnect()
end)
function rnet.setphysicsrootpart(instance: BasePart)
changes metamorphical root part for character physics.
Currently does nothing.
instance
- instance to set
-- no example until it works
function rnet.send(packetsList: array)
sends custom packet, values that you are going to set must be byte hex.
Don't send random packets, it might get u banned doing it.
packetsList
- array of packets to send
rnet.setfilter({0x2, 0x65, 0x108, 0x69}) -- this is just random nonsense, but it shows the point that an array table should be used
huh