The RakNet library provides an interface for the RakNet networking framework within Roblox.
Note This documentation covers only stable and verified functions. Experimental or unstable features are excluded. For additional context, refer to the original source.
function rnet.blockcreates(arg1: boolean)Enables or disables filtering of "ID_NEW_INSTANCE" packets, currently limited to blocking RightGrip creation.
arg1: A boolean indicating whether to filter create instance packets (trueto enable,falseto disable).
rnet.blockcreates(true) -- Blocks RightGrip creation packets.function rnet.blockdeletes(arg1: boolean)Enables or disables filtering of "ID_DELETE_INSTANCE" packets, preventing client-side deletions from being sent to the server.
arg1: A boolean indicating whether to filter delete instance packets (trueto enable,falseto disable).
local player = game:GetService("Players").LocalPlayer
local character = player.Character
rnet.blockdeletes(true)
character["Left Leg"]:Destroy() -- Deletion is not sent to the server.function rnet.destroy(instance: Instance)Sends a "DELETE_INSTANCE" packet to destroy the specified instance.
instance: The instance to destroy.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
rnet.destroy(character.Torso.Neck) -- Destroys the neck weldfunction rnet.disconnect()Destroys the client's replicator, disconnecting the client from the server.
- None.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
character.Humanoid.Died:Connect(function()
rnet.disconnect() -- Disconnects the client upon death.
end)function rnet.equiptool(tool: Tool, weld: Weld?, alsoUnequip: boolean?)Equips the specified tool to the character.
tool: The tool to equip.weld: An optional custom weld for the tool.alsoUnequip: An optional boolean indicating whether to unequip the tool afterward.
local player = game:GetService("Players").LocalPlayer
local backpack = player.Backpack
rnet.equiptool(backpack:GetChildren()[1]) -- Equips the first tool in the backpack.function rnet.fireevent(instance: Instance, eventName: string, ...: any)Triggers the specified event (eventName) on the given instance with the provided arguments. This function is equivelent to Synapse/SW's firesignal.
instance: The target instance on which to fire the event.eventName: The name of the event to trigger....: Variable arguments to pass to the event.
local player = game:GetService("Players").LocalPlayer
local backpack = player.Backpack
local character = player.Character
-- Equips the first tool in the player's backpack on the server.
rnet.fireevent(character.Humanoid, "ServerEquipTool", backpack:GetChildren()[1])function rnet.fireremote(remote: RemoteEvent | RemoteFunction, count: number, ...)Fires the specified remote (RemoteEvent or RemoteFunction) count times with the given arguments.
remote: The remote to fire.count: The number of times to fire the remote....: Arguments to pass to the remote.
local remote = game:GetService("ReplicatedStorage").DefaultMakeChatSystemEvents.SayMessageRequest
rnet.fireremote(remote, 5, "message", "All") -- Sends the message "message" to all players 5 times.function rnet.getevents(instance: Instance): arrayRetrieves a table containing the names and metadata of events associated with the specified instance.
instance: The instance to query for events.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local eventNames = rnet.getevents(character.Humanoid)
table.foreach(eventNames, print) -- Prints the list of event names.function rnet.getproperties(instance: Instance): arrayReturns a table of hidden properties for the specified instance.
instance: The instance to query for hidden properties.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local hiddenProperties = rnet.getproperties(character.Humanoid)
table.foreach(hiddenProperties, print) -- Prints the list of hidden properties.function rnet.nextpacket(): stringRetrieves the most recent packet sent by the client to the server.
- None.
-- See the `rnet.readeventpacket` example for usage.function rnet.readeventpacket(packet: string): dictionaryDecodes a packet and returns a dictionary containing event information. This function is useful for analyzing packet-based events.
A dictionary with the following fields:
| Field | Type | Description |
|---|---|---|
source |
Instance | The instance associated with the event. |
name |
string | The name of the triggered event. |
arguments |
array | The arguments passed to the event. |
packet: The packet to decode.
local packetNumber = 0
while true do
task.wait()
local packetData = rnet.nextpacket()
if packetData.id == 0x83 and packetData.subid == 0x7 then
pcall(function()
local packetInfo = rnet.readeventpacket(packetData)
print(string.format("Packet #%d: Event [%s] on %s",
packetNumber,
packetInfo.name,
packetInfo.source:GetFullName()
))
end)
end
packetNumber += 1
endNote: This function may exhibit inconsistent behavior in certain scenarios.
function rnet.send(packetsList: array)Sends custom packets specified in packetsList. Packet values must be in byte-hex format.
Warning Sending arbitrary packets may result in a ban. Use with caution.
packetsList: An array of packets to send.
rnet.send({{0x2, 0x65, 0x108, 0x69}}) -- Sends a custom packet (example).function rnet.sendphysics(position: CFrame)Sends physics packets to update the character's position (as a CFrame) to other clients.
position: TheCFramerepresenting the character's new position.
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)
endfunction rnet.setfilter(filteringPacketIds: array)Filters packets by their IDs or sub-IDs, preventing the client from sending packets that match the specified criteria.
filteringPacketIds: An array of packet IDs or sub-IDs to filter.
-- Filters packets starting with the specified ID sequence.
rnet.setfilter({{0x2, 0x65, 0x108, 0x69}})function rnet.setparent(instance: Instance, newParent: Instance)Sets the parent of the specified instance to newParent.
instance: The instance to reparent.newParent: The new parent instance.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
rnet.setparent(humanoid, workspace) -- Sets the humanoid's parent to the workspace.function rnet.setphysicsrootpart(instance: BasePart)Attempts to set the specified instance as the root part for character physics calculations.
Issue: This function is currently non-functional.
instance: The instance to set as the physics root part.
-- No example available until the function is operational.function rnet.setproperty(instance: Instance, propertyName: string, value: any)Sets the value of a hidden property (propertyName) on the specified instance.
instance: The instance to modify.propertyName: The name of the hidden property to set.value: The value to assign to the property.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
rnet.setproperty(humanoid, "AHiddenProperty", true) -- Sets a hidden property (example).function rnet.sit(seat: SeatPart, humanoid: Humanoid)Forces the specified humanoid to sit on the given seat, creating a weld on the server.
seat: TheSeatPartto sit on.humanoid: The humanoid to seat.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local seat = workspace.SeatPart
rnet.sit(seat, character.Humanoid) -- Seats the player on the specified seat.function rnet.touch(part1: BasePart, part2: BasePart)Simulates a touch interaction between part1 and part2.
part1: The part being touched.part2: The part initiating the touch.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local killbrick = workspace.KillBrick
rnet.touch(killbrick, character.HumanoidRootPart) -- Simulates a touch, potentially killing the character.function rnet.unequiptool(tool: Tool)Unequips the specified tool from the character.
tool: The tool to unequip.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
rnet.unequiptool(character:FindFirstChildOfClass("Tool")) -- Unequips the equipped tool.