#Packet - Networking Library

1 messages · Page 2 of 1

ruby crypt
#

but if I understand switch back correctly then your signal module does not support spawn

#

no there for you

#

I make them for fun

elder bone
ruby crypt
#

if it moves before the current index

elder bone
ruby crypt
#

yer so imagen your looping and your at index 3 and swap 5 to index 2

#

now your fire will skip 5

elder bone
#

:O

#

That is not good

ruby crypt
#

yup

elder bone
#

I will switch immediately

#

ty

ruby crypt
#

yes your signal module only supports defer

#

you can't do spawn

elder bone
#

For certain scenarios at least

ruby crypt
#

also if you have once

#

and your once disconnects instantly

#

it could have the same problem

#

also wait could also have problems

elder bone
#

Yea wait is basically a once connection

ruby crypt
#

yer so if you move it into the current index do you fire the same index again?

#

before moving upto the next index

elder bone
#

That works at least

#

They can disconnect themselves but not others then it will break

ruby crypt
elder bone
#

Wait

#

No

#

I don’t because I wrap the users function in my disconnect function.

#

That could be problem

#

Wait nah it should all work

#

I genuinely think it’s safe with self disconnects

ruby crypt
elder bone
#

@ruby crypt Is it required to use Packet.Nil or can I just input nothing?

frozen oyster
#

If u dont pass anything in as variable

elder bone
#

I'm talking about packet definitions, btw.

#

Not when firing packets.

frozen oyster
ruby crypt
elder bone
ruby crypt
elder bone
rain rock
ruby crypt
rain rock
#

that makes sense

#

so it's just a result of internals

ruby crypt
#

any uses a separate function for nil

rain rock
#

I see

rain rock
#

Im already hearing about packet on any network library discussion

ruby crypt
#

I know net rays used my code from the first versions of packet

rain rock
ruby crypt
#

before I merged it into 1 module

rain rock
#

I mean the license says it's free of charge but I don't like people that doesn't credit

ruby crypt
#

but I don't know if netray still uses my code

rain rock
#

after getting lot of hate

ruby crypt
#

I did not know glad packet existed

rain rock
#

and also dude was yapping about how sending 800 "A"s in a single string was 8x better in his library

#

which makes no sense since he has compression

#

He was doing unfair comparisons among network libraries and unproperly benching them

ruby crypt
#

buffers have built in compression

rain rock
#

which cant see the compression from roblox

ruby crypt
#

right

rain rock
#

I mean later he changed to performance stats

#

dk if that can see buffer compressions?

ruby crypt
#

no nothing can see it

rain rock
#

then yeah

ruby crypt
#

only the network thing built into studio

rain rock
#

the Network stats in studio

ruby crypt
#

yer

#

that will show you the real amount of data being sent

rain rock
ruby crypt
#

ok

#

hows the cpu usage?

rain rock
#

but without compression it was p much same

#

Packet being a little slower

elder bone
#

Does Packet support unreliable remote events?

silent spire
#

😁

elder bone
orchid hatch
#

u just copy paste the code in the forum

rain rock
elder bone
#

And normal UnreliableRemoteEvents otherwise.

ruby crypt
#

yup its a way to support unreliable without adding any extra complexity to the packet module

elder bone
#

Does Packet.Any choose the option with the lowest byte usage?

#

For example, if I input 1 with Packet.Any as the type, will it choose Packet.NumberU8?

silent spire
#

its pretty easy to check in the source code

ruby crypt
elder bone
#

That is amazing

#

Then why not always use Packet.Any over anything else?

ruby crypt
#

because the sign of the number is saved in the type byte

elder bone
#

:O

#

But won't it still often take up less space?

ruby crypt
elder bone
#

Oh a full extra byte damn

ruby crypt
#

so u8 will normally use 1 byte but any within the rang of -255 to 255 will use 2 bytes

#

if you have a wide range of number then any might beat using a fixed type

silent spire
#

while if you use a fixed type for example u8 its guaranteed to be a number in 0-255 range

elder bone
#

That's minor CPU usage.

#

Unnoticable at a realistic scale.

silent spire
#

i mean i like it more cuz it makes your code cleaner by not adding checks everytime

#

cpu usage is not a concern ye

young token
#

I am getting this warning:

20:22:02.475 OnClientInvoke not found for packet: RollGUI discarding event: None 9.199999809265137 - Client - Packet:334
20:22:12.458 nil - Server - GameManager:28
20:22:15.490 Response thread not found for packet: RollGUI discarding response: true

#

I have set up a client invoke on the client

#

can someone help?

#

this is how I call FireClient: ```lua

Packets.RollRequest.OnServerEvent:Connect(function(player: Player, ...)
local name, cap = Abilities.Roll()

local accepted = Packets.RollGUI:FireClient(player, name, cap)
print(accepted)
if not accepted then return end
local entity = World.GetEntityByInstance(player)
local abilityComp = entity:GetComponent(Components.Abilities) :: typeof(Components.Abilities.new())

abilityComp.Equipped.Value = Abilities.CreateBaseAbility(name,0, cap)

end)

ruby crypt
ruby crypt
still dust
#

Task.defer?

ruby crypt
#

then change the order of your code so that it sets up before the error

young token
# ruby crypt based on the error message you have not set it up

this is my code on the client side:

-- LocalScript: PlayerUIController
-- Location: e.g., StarterPlayer/StarterCharacterScripts

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Trove = require(ReplicatedStorage.Libs.Trove)
local number_format = _G.number_format
local Utils = require(game.ReplicatedStorage.Libs.Utils)
-- Get the ClientDataManager module
local ClientDataManager = require(Players.LocalPlayer.PlayerScripts.ClientDataManager)
local Packets = require(game.ReplicatedStorage.Shared.Remotes.Packets)

local HealthGUIEvent = game.ReplicatedStorage.Shared.Remotes.Health

local Components = require(game.ReplicatedStorage.Shared.Components.Components)

local Colors = require(game.ReplicatedStorage.Libs.Colors)
-- Wait for the GUI
local player = Players.LocalPlayer
local playerGui:typeof(player.PlayerGui) = player:WaitForChild("PlayerGui")
local infoGUI = playerGui:WaitForChild('InfoGUI')
local PlayerInfoFrame = infoGUI.PlayerInfo

local uiTrove = Trove.new()
local Entity = require(game.ReplicatedStorage.Shared.Entity)

local Icon = require(script.Icon)
local Abilities = require(game.ReplicatedStorage.Abilities)
local Menu = infoGUI.Menu
local TechniqueData = require(game.ReplicatedStorage.Shared.Data.TechniqueData)

Packets.RollGUI.OnClientInvoke = function(name, level) 
    print(name, level)
    return false
end

have I done it wrong?

ruby crypt
young token
#

right after I require the packets module?

ruby crypt
young token
#

got it. I just did and I still get the warning.

-- LocalScript: PlayerUIController
-- Location: e.g., StarterPlayer/StarterCharacterScripts
local Packets = require(game.ReplicatedStorage.Shared.Remotes.Packets)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Trove = require(ReplicatedStorage.Libs.Trove)
local number_format = _G.number_format
local Utils = require(game.ReplicatedStorage.Libs.Utils)
-- Get the ClientDataManager module
local ClientDataManager = require(Players.LocalPlayer.PlayerScripts.ClientDataManager)

Packets.RollGUI.OnClientInvoke = function(name, level) 
    print(name, level)
    return false
end
local HealthGUIEvent = game.ReplicatedStorage.Shared.Remotes.Health

local Components = require(game.ReplicatedStorage.Shared.Components.Components)

local Colors = require(game.ReplicatedStorage.Libs.Colors)
-- Wait for the GUI
local player = Players.LocalPlayer
local playerGui:typeof(player.PlayerGui) = player:WaitForChild("PlayerGui")
local infoGUI = playerGui:WaitForChild('InfoGUI')
local PlayerInfoFrame = infoGUI.PlayerInfo

local uiTrove = Trove.new()
local Entity = require(game.ReplicatedStorage.Shared.Entity)

local Icon = require(script.Icon)
local Abilities = require(game.ReplicatedStorage.Abilities)
local Menu = infoGUI.Menu
local TechniqueData = require(game.ReplicatedStorage.Shared.Data.TechniqueData)


print(os.clock(), 'ras')

also, i added a print in the packet to see what was going on. somehow there is one time without the invoke and another time with the invoke

#
  09:36:55.802  > local Packets = require(game.ReplicatedStorage.Shared.Remotes.Packets) Packets.RollRequest:Fire()  -  Studio
  09:36:55.868   ▼  {
                    ["Id"] = 10,
                    ["Name"] = "RollGUI",
                    ["OnClientEvent"] =  ▶ {...},
                    ["Reads"] =  ▶ {...},
                    ["ResponseReads"] =  ▶ {...},
                    ["ResponseTimeout"] = 10,
                    ["ResponseWrites"] =  ▶ {...},
                    ["Writes"] =  ▶ {...}
                 } 1008.7407739000046 rab  -  Client - Packet:334
  09:36:55.868  OnClientInvoke not found for packet: RollGUI discarding event: None 9.300000190734863  -  Client - Packet:335
  09:36:55.868   ▼  {
                    ["Id"] = 10,
                    ["Name"] = "RollGUI",
                    ["OnClientEvent"] =  ▶ {...},
                    ["OnClientInvoke"] = "function",
                    ["Reads"] =  ▶ {...},
                    ["ResponseReads"] =  ▶ {...},
                    ["ResponseTimeout"] = 10,
                    ["ResponseWrites"] =  ▶ {...},
                    ["Writes"] =  ▶ {...}
                 } 1008.7415970999864 rab  -  Client - Packet:334```
#

i set up the 'ras', 'rab' timing thing to see if there was race conditions

#

there werent 😦

#

i have no idea why there would be two calls

ruby crypt
young token
#

ok

#

didn't work 😦

-- LocalScript: PlayerUIController
-- Location: e.g., StarterPlayer/StarterCharacterScripts
local Packets = require(game.ReplicatedStorage.Shared.Remotes.Packets)
Packets.RollGUI.OnClientInvoke = function(name, level) 
    print(name, level)
    return false
end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Trove = require(ReplicatedStorage.Libs.Trove)
local number_format = _G.number_format
local Utils = require(game.ReplicatedStorage.Libs.Utils)
-- Get the ClientDataManager module
local ClientDataManager = require(Players.LocalPlayer.PlayerScripts.ClientDataManager)


local HealthGUIEvent = game.ReplicatedStorage.Shared.Remotes.Health

local Components = require(game.ReplicatedStorage.Shared.Components.Components)

local Colors = require(game.ReplicatedStorage.Libs.Colors)
-- Wait for the GUI
local player = Players.LocalPlayer
local playerGui:typeof(player.PlayerGui) = player:WaitForChild("PlayerGui")
local infoGUI = playerGui:WaitForChild('InfoGUI')
local PlayerInfoFrame = infoGUI.PlayerInfo
#
  09:42:29.907   ▶ {...} 1342.777631199977 rab  -  Client - Packet:334
  09:42:29.908  OnClientInvoke not found for packet: RollGUI discarding event: None 9.600000381469727  -  Client - Packet:335
  09:42:29.908   ▶ {...} 1342.77833489998 rab  -  Client - Packet:334
  09:42:41.949  Response thread not found for packet: RollGUI discarding response: true  -  Server - Packet:287
  09:43:01.811  Disconnect from ::ffff:127.0.0.1|53933  -  Studio
  09:43:01.816  ReplicationSystem: Stopped replication for Player_1341.547677800001  -  Server - ReplicationSystem:183```
#

if anyone has any ideas of how to help, id gladly listen

#

ill just use a regular remotefunction as a workaround for now

rain rock
young token
rain rock
#

like task.wait(2)

young token
#

a delay before client?

#

what do you mean?

young token
#

i tried to do some investigation:

the while loop runs twice and the second time, the packet has the clientinvoke

#

i did the 'i' thing to see if the ReadU8 was different in both times, there are the same

#

addition: the while loops runs tiwce because the OnClientEvent fires twice. I'll look further into it

#

addition: the OnCLientEvent fires twice because the connection happens twice

#

ill look into it

rain rock
#

yeah you need to fire once

young token
#

The event fired twice because the event was connected multiple times

#

I went to bed to deal with it today after my appointment

young token
#

I think this whole thing was just me being silly

#

i figuredd out that the event was connected multiple times because the packet module gets required and initialized twice on the client for some reason

#

i think that may be cuz i am using the command bar

#

ill test it out

#

yep

#

seems to be why

#

the command bar and the local scripts seem to be in different environments of something liek that

young token
#

fixed the client side, now working on the server side not seeing a response thread for some reason

young token
#

yeah, i have no idea. the threadIndex is 0 and the index on the playerThread table is 1:

#

this may be the same thing lhat alexander may be referring to here

young token
#

hm... ill do some more testing and get back to you

#

yeah, it works perfectly in another place, but not in 'dop slop'...

#

ill keep testing. should be a problem with my place, im thinking

#

IT WORKS NOW all of a sudden

#

i dont know what changed though

#

one thing that did change was this:
13:34:54.041 0 ▼ {
[0] = ▶ {...},
["Index"] = 1
} mark - Server - Packet:293

#

before the [0] in the table wasnt there

#

that is something that changed

#

previously, the index was the only key in the table

ruby crypt
rain rock
#

this doesn't error

#

but this errors

#

super weird

#

1st one

#

2nd one

#

I can see from here packet recieves a remote before main packets are defined

#

so this means not packets fault

#

Im leaving this for everyone who stumbles packet not being found error

#

you have some run order issue

#

make sure to define packets as the first thing both on client and server

mint laurel
safe eagle
#

Hi, I'm wondering if it's worth switching to Packet from Bytenet. Therefore a question, can I disconnect events (disable listeners or sum) in Packet?

modest bough
#

is type checking working?

humble ivy
safe eagle
ruby crypt
#
local p = Packet("Name")
local connection = p.OnClientEvent:Connect(MyFunc)

connection:Disconnect()
humble ivy
#

oh it does exist

#

might be worth putting that in the documentation

rain rock
mint laurel
#

though I’ll say it makes it more difficult to do so, and id prolly prefer to just do rs myself, as I’ve done in the past

#

I’ve just been trying to do get into better development practices

rain rock
elder bone
mint laurel
#

i meant StarterPlayerScripts mb

rain rock
#

🗣️ 🔥

#

PlayerScriptService

#

when

elder bone
#

why is that an emoji bro 😭

mint laurel
elder bone
#

wrong

#

Banana

sand fern
#

wouldnt it be easier if you could just put all your remotes in a module in replicated storage?

past dust
#

btw

silent spire
#

someone give this man a medal

#

suphi pin that

vapid ore
#

adding this wont cause any read/write problems right? (trying to suppress an error)

silent spire
#

i think so

#

better to wait for suphi's answer tho

rain rock
#

it is supposed to error so you dont drop events

#

as long as you're aware it's fine to patch it like this

rain rock
#

this has your solution

vapid ore
# rain rock no it wont but you're dropping events just be aware

yeah i know
sometimes theres nonessential events i have like notifications cause the client waits for the player to load before doing anything so events may be dropped during that time
for the essential packets i call the server saying that the player is ready to recieve essential data

rain rock
vapid ore
rain rock
#

it will work

vapid ore
#

oh i thought it was based on when i setup the receiving connection

rain rock
#

yeah no as long as you require every single packet in one go without yielding it should never error

#

nor drop events

vapid ore
#

k thanks

pulsar cypress
#

Hey I use Red currently and I’m looking to switch away from it as it has huge amounts of script usage in higher player servers, will packet considering (I think at least?) have similar issues?

#

Am I better off for 150 player plus servers just using normal remotes

silent spire
#

batching and serialization will probably help a lot

pulsar cypress
#

Do you know if there’s a server CPU hit with a lot of players?

silent spire
#

its not specifically the amount of players that use cpu that much, its how much events your sending them, which scales with players

#

packet is super simple you can just test it out

pulsar cypress
#

I’ll give it a go and come back if I have any issues

silent spire
#

aight

rain rock
#

afaik

#

but packet should never hit any of these limits

#

it is quite fast

latent depot
#

@ruby crypt how do i add new types and enable dynamic typechecking for 1.7?

ruby crypt
#

runtime type checking was removed

latent depot
ruby crypt
#

copy the type that is closest to the type you want to make and edit it

#

if you get stuck tell me and ill help you finish the type

latent depot
#

i want to have a simple type for error messages

#

what would this look like?

ruby crypt
#

then you can use the static type

#

you can rename, clone or copy one of the static types

latent depot
latent depot
ruby crypt
#

something like

assert(packet:Check("string", 1234, true), "Types dont match")
latent depot
ruby crypt
#

maybe

#

but remeber its imposibale for a exploiter to send the wrong types

#

so if you only want this to check what the client sends

#

then it wont do anything

#

well only the Any type will allow the client to send the wrong types

latent depot
#

ty ill try out what said

latent depot
ruby crypt
rain rock
#

which is kinda powerful icl

ruby crypt
hidden vine
#

if a script holding the .OnClientEvent or .OnServerEvent is deleted, does the connection still exist?

hidden vine
# ruby crypt yes

Is there a way to make them delete themselves from script deletion?

ruby crypt
hidden vine
# ruby crypt use a Bindable event

What do you mean sorry I'm confused by this

for example my issue is I have UI in my game that comes from a ScreenGui that has "ResetOnSpawn" set to true since I want it to reset when the player respawns, however the script within this ScreenGui contain Packets which will linger each time they die

ruby crypt
hidden vine
#

i see now thanks

ruby crypt
#

you could even modify the signal module to call the Bindable event

hidden vine
#

i have no idea how to do that tbh

#

but the bindable event stuff i understand

ruby crypt
#

yer just have a master connection

rain rock
# ruby crypt yer just have a master connection

suphi if I don't recall wrong you had a bug with :Wait in the Signal included in Packet, when multiple of :Wait are called at the same time they just give up instead of resuming all waiting threads

#

it doesn't affect packet of course

#

but yeah it's a bit weird

#

why didn't you use Suphi Signal instead

#

but made a seperate one for packet

ruby crypt
ruby crypt
rain rock
#

it's been a while I dont remember

#

But it was :Wait

rain rock
#

I can't seem to recreate it right now unfortunately 🥀

#

we're good until it happens again

ruby crypt
rain rock
ruby crypt
#

stopping all the other connection from firing

rain rock
ruby crypt
hidden vine
hidden vine
# ruby crypt yes

is it possible to make these connections auto delete if the script they're in no longer exists

ruby crypt
hidden vine
#

@ruby crypt if you send really large value into a Packet, it can fire completely other random Packets

hidden vine
# ruby crypt are you sending large strings?

there is a thing ingame where you can change the boombox audio, it accepts Packet.Any but it sends as a number, they sent

5409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995 which as seen in the screenshot is also firing completely random packets with random string values

ruby crypt
#

thats a string

#

you need to use a longstring

hidden vine
ruby crypt
#

strings only allow 255 characters
longstrings allow 65,535 characters
when you use any it defaults to string not long string

ruby crypt
hidden vine
#

so when you go above the 255 it just fires random packets

ruby crypt
hidden vine
#

something else that was really weird is something it would teleport everyone on the map to the center of the world

humble ivy
ruby crypt
humble ivy
#

you dont even need a client for it

hidden vine
#

actually that is true mb

#

but is there anything that would cause every player on the map to be tped to the center

ruby crypt
#
anyReads[11] = function() return ReadString(ReadU8()) end
anyWrites.string = function(value: string) local length = #value Allocate(2 + length) WriteU8(11) WriteU8(length) WriteString(value) end

change this
to

anyReads[11] = function() return ReadString(ReadU16()) end
anyWrites.string = function(value: string) local length = #value Allocate(3 + length) WriteU8(11) WriteU16(length) WriteString(value) end
#

if you want any strings to default to long strings

ruby crypt
#

but if the data overflows then the events parims will have random values

hidden vine
#

ok thanks

ruby crypt
#
packet.onevent(function(x: Number, y: Number, z: Number)
    -- a exploiter can send any numbers they want
    -- but there type will always be number unless you use any
end)
ruby crypt
humble ivy
#

well when encoding a string you can check the length of the string against the maximum possible characters for that type

#

and just make sure it doesnt overflow

#

would be like

if #input > 255 then
    input = string.sub(input, 1, 255)
end
hidden vine
#

would you still need the check you could just do input = string.sub(input, 1, 255) by default

#

or is that bad idk

humble ivy
#

could

#

i dont think that can cause problems

#

but yeah
it wont stop exploiters from sending invalid packets but itll stop accidental overflows that can occur without using exploits

silent spire
#

if you just send a big string just use Packet.LongString instead of Packet.Any

hidden vine
silent spire
hidden vine
#

it sends a number and then the boombox audio is changed on the server

#

just what was happening is players would send insanely large numbers which was triggering random packets with random values

silent spire
#

are you sure it was "triggering random packets"?
and the random values are probably overflow so for example if you put NumberU8 type which is 0-255, and send like 256 it will become 0, 257 will become 1 etc

humble ivy
#

if you send a string of length 256, itll overflow and read 0, meaning now you have 256 bytes of garbage data being read as batched packets

silent spire
#

can that cause any issues

#

because from what i can understand if exploiter sends that cursed string then server side can randomly fire incorrect values?

humble ivy
#

the fact that its a string was lost when it overflowed
so you have a bunch of bytes that packet has no idea how to interpret, and itll do its best to read those bytes as valid data for who knows how many other packets

hidden vine
#

Is there any way to check what Packet was being fired by name for testing reasons through a print statement

humble ivy
#

done correctly, you can decipher how the game's events are laid out and which packets do what, without the need for an exploit client

#

thats the dangerous part, literally anyone can break it and they dont even need an executor

silent spire
humble ivy
#

you dont need to check the types, packet will read the bytes as whatever type it wants, whether it was originally valid or not

hidden vine
#

trying o find what random packet just tps every player to the middle of nowhere 😭

ruby crypt
hidden vine
#

Whenever a Packet is Sent, it prints the Packet Name in Output

silent spire
#

may be try packet profiler

#

you can see the most recent event after players tp (i realized it wont help)

ruby crypt
humble ivy
#

doesnt packet use one remote event

silent spire
humble ivy
#

yes

#

that is guaranteed to be read as a string, no matter what bytes were fired

#

since packet doesnt encode the type unless you use Any

silent spire
#

ok good

humble ivy
#

and if you use Any, you have to do your own type validation

silent spire
#

i always liked that you didnt have to check the type

silent spire
#

cuz static can be anything that you put in it

humble ivy
#

static i would hope you know the types for considering you put your own values in a table that it can choose from

humble ivy
hidden vine
silent spire
hidden vine
#

320+ish

humble ivy
#

yeahh hundreds of packets means its very easy to hit a valid packet with an overflowed string

#

you can go into the packet module and add a line that prints the packet id that teleports you places

hidden vine
#

ye im trying to find it now im just very lost ngl

humble ivy
#

and from the id you can get the name

#

are you sure the tp is from a server -> client packet?

hidden vine
#

Actually it'd be better to add a print for OnServerEvent

silent spire
hidden vine
#

I'm not sure what exactly is causing the TP but if I could know what packets are triggering then I think I could find out the issue from there

silent spire
hidden vine
#

i don't think so i've had no issue with this many

#

other than this

#

i try not to spam so many packets but there's just so many things in my game its hard to avoid it

#

actually wait i only have 232 Packets mb i was counting the spaces

silent spire
#

yea well its 256 max

#

you can increase it to 65k but it will use 2 bytes instead of 1 for packet id

hidden vine
#

ok thanks

rain rock
#

they can always do that

hidden vine
#

ok i found it Hooray!

#

It's on a OnClientEvent

#

this this fires randomly

#

if u send insanely larger number

ruby crypt
#

i think its a string of numbers

hidden vine
# ruby crypt number or string

i was sending the bottom through a Packet.Any5409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995

ruby crypt
#

with any a very large number is sent as a 64 bit float it will never overflow

ruby crypt
#

if you want any to support bigger string you can change

anyReads[11] = function() return ReadString(ReadU8()) end
anyWrites.string = function(value: string) local length = #value Allocate(2 + length) WriteU8(11) WriteU8(length) WriteString(value) end
```to
```lua
anyReads[11] = function() return ReadString(ReadU16()) end
anyWrites.string = function(value: string) local length = #value Allocate(3 + length) WriteU8(11) WriteU16(length) WriteString(value) end
hidden vine
#

o yeah it was string mb

#

i forgot to tonumber the send

ruby crypt
#

you should send it as a longstring

#

or if you still want to use any you have to make the change i showed above

hidden vine
#

the number isn't meant to be so long anyways, i'll cut the amount that's sent over thanks for the help

past mist
#

fix types type checking 🙏

silent spire
past mist
#

i think so

silent spire
#

well its in beta for a reason

rain rock
#

yeah

#

packet was written in old type solver

#

fix beta type solver 🙏

past mist
#

fr

#

😭

ruby crypt
#

or we send a bug report to roblox telling them to fix the problem

past mist
#

okay

ruby crypt
#

hopefully once the new one comes out of beta its fully compatible with the old version

past mist
#

btw can i message you in dms about some questions

ruby crypt
#

you can message me questions in the server

past mist
#

okay

#

ill ping you in chat in a second

ruby crypt
#

k but im going offline now

past mist
#

kk

copper sparrow
#

I'm getting DevKrazes ReplicatedStorage.Packages.Packet.Types:66: buffer access out of bounds

-- Client
self.packet = self.framework.packages.Packet
self.doorUsePacket = self.packet("DoorUse", self.packet.Instance, self.packet.Boolean8)
    :Response({ success = self.packet.Boolean8, message = self.packet.String })
...
-- door is an Instance, isInFront is a boolean
local response = self.doorUsePacket:Fire(door, isInFront)
-- Server
local DoorUsePacket = packet("DoorUse", packet.Instance, packet.Boolean8)
DoorUsePacket.ResponseTimeout = 3
DoorUsePacket.ResponseTimeoutValue = { success = false, message = "Server Timed Out" }
DoorUsePacket.OnServerInvoke = function(plr: Player, door, isInFront: boolean)
    ...
    return { success = true, message = "Passed all checks" }
end

Unsure how to fix this

ruby crypt
fleet ermine
#

Will we ever get direct support for optional types?
Like for example

local Event = Packet("Event", Packet.Optional(Packet.Instance))

Event.OnServerEvent:Connect(function(player: Player, instance: Instance?)
  -- code
end)
fleet ermine
rain rock
#

client can never know if an argument is optional or not without encoding it in

#

which would ultimately result in more bytes getting used

#

at the end it should be same as passing nil to Packet.Any

ruby crypt
#

in fact any could end up being better for data usage when using numbers

#

because any will dynamically scale how many bytes it needs based on how big the number is

hidden vine
#

given sending insanely large or random packets from the client can trigger random packets with random values, is there truly no way for an exploiter to basically like loadstring, or loadasset something, etc

hidden vine
#

sorry my game got backdoored i'm thinking of every possibility on how it could've happened

orchid hatch
#

have u tried

#

ctrl shift f keywords

require
loadstring

#

:PostAsync

hidden vine
#

ye, but i think i foudn the issue, had to do with loadasset i think

#

not entirely sure yet tho

rain rock
humble ivy
humble ivy
#

that one packet addon i made a while back

rain rock
#

oh yeah bitstruct

hidden vine
#

whats this mean, is it normal? I see it in Luauheap

rain rock
hidden vine
#

which is referring to this

rain rock
#

not a mem leak

hidden vine
#

ok thanks

stone pasture
#

does packet.any with optional type serialize? or no(i forgot)

ruby crypt
silent spire
#

when using Packet.Any you need to check if the type is correct, but when using for example Packet.String its guaranteed to be a string and i think thats nice

pulsar cypress
#

bro what is wrong with this

ruby crypt
pulsar cypress
#

thread is signal that is supposed to be fired when response received or

ruby crypt
#

ummm maybe not sure

#

it says client on the warning

#

maybe you have a low timeout

#

and the server does not return quick enough

#

do you have waits in the server function

pulsar cypress
pulsar cypress
pulsar cypress
ruby crypt
#

yer the server should not wait and return the information instantly

pulsar cypress
ruby crypt
#

then think of another way to do it

pulsar cypress
ruby crypt
#

use 2 remote events

#

not a remote function

rain rock
drifting mountain
rain rock
#

Ill explain gimme a min

#

CFrameF24U8 -> 12 bytes -> Position: (3, 3, 3) Rotation: (1, 1, 1)
CFrameF32U8 -> 15 bytes -> Position: (4, 4, 4) Rotation: (1, 1, 1)
CFrameF32U16 -> 18 bytes -> Position: (4, 4, 4) Rotation: (2, 2, 2)

#

CFrame 18 is closests to normal roblox CFrames

#

CFrame 15 gives a good positional range but rotation is a bit limited

humble ivy
rain rock
#

CFrame 12 gives bad range and rotation is also limited

rain rock
rain rock
ruby crypt
rain rock
#

fixed

ruby crypt
#

if I remember correctly

rain rock
#

but still closest to roblox

#

very close right?

#

I kinda remember your tests

ruby crypt
#

I can't remember

rain rock
#

I'm so glad I could participate

#

🔥

pulsar cypress
#

like less precise or it doesnt replicate past some value

rain rock
#

for rotation it's less precise

pulsar cypress
#

ic

oblique wagon
silent spire
#

you need to declare packets at start

oblique wagon
#

Should I have a separate script that runs on plr join?

#

that instantiates the packets

silent spire
#

you could create a "Packets" Module where you store the packets

silent spire
oblique wagon
#

I shouldn't run all scripts on join either, what are you suggesting?

silent spire
oblique wagon
silent spire
#

that didnt help

oblique wagon
silent spire
oblique wagon
#

Thanks for your help

#

I still don't understand why this works

#

Because modules don't load themselves.. and I'm requiring the module when the localscript loads

rain rock
#

that should fix it

#

If you are having this particular error: attempt to index nil with 'ResponseReads'
You're probably firing a packet that hasn't been defined by the client or the server.

What does this mean?

It means Packet module started and recieved data about an undefined packet.

Why does it happen?

It happens because Packet connected but not all packets are initialized. So Packet tried to find the packet and it resulted in nil.

How to fix?

Initialize all packets on the same frame Packet module is required for the first time (started)

Why is this error not handled?

Erroring is wanted behavior here. Prevents the developer from silently missing any packets leading to silent bugs.

#

@ruby crypt can we get this pinned

oblique wagon
#

thx

past dust
silent spire
#

oops forgot to disable mention

#

hi sinek

hidden vine
#

i already use something like this, as this is how I define all my Packets

#

not sure if thats what you mean

rain rock
#

what's so confusing about that

rain rock
#

ruby crypt
rain rock
woeful cliff
#

could someone tell me what this means and what the cause could be? this hasnt happened before

rain rock
ruby crypt
#

Or maybe your script gets destroyed before the server/client can respond

woeful cliff
ruby crypt
woeful cliff
ruby crypt
#

Its coming from return settings and return saved outfits

#

When do you fire them packets

woeful cliff
#

When the module loads that fires the packets*

#

they get fired instantly, should i make it wait a bit before firing?

ruby crypt
#

Don't think so

#

Ummmm maybe

#

Put a print after you fire it to see what it responds with

#

If the response is nil then it timed out

#

Maybe the client took to long to load and respond

woeful cliff
#

Okay

woeful cliff
ruby crypt
#

Are you sending a huge amount of data or something

woeful cliff
#

highest would be a table with 3-4 keys

ruby crypt
#

What is line 309

woeful cliff
#

One moment

woeful cliff
ruby crypt
#

Umm

#

That's confusing

woeful cliff
#

Hm okay

ruby crypt
#

Does this happen every time?

woeful cliff
#

The code related to the warning hasnt been changed since it was finished and the warning didnt happen around that time

#

And the error above is new

ruby crypt
#

I don't know

feral schooner
#

does the player count as an instance?

#

in the packet syntax

#

and does firing from the client automatically give the server a player parameter like the default remote events/functions do

feral schooner
#

Nvm

#

I figured it out

pulsar cypress
#

@ruby crypt Any possible case when Instance doesn't get received on client?

#

I send a part with weld inside it as Instance in a packet

#

On client it's nil somewhy

#

Although all other arguments receives normally

#

Made sure the part is visible to client too

ruby crypt
pulsar cypress
ruby crypt
#

This happens because of content streaming

pulsar cypress
#

For some dumb reason

#

But instance type doesn't work

#

No matter what

#

Just wanted to know if you got any idea on why & how fix

ruby crypt
#

If you temporarily turn content streaming off does it work with packet

pulsar cypress
#

Can It be so roblox gives different UniqueId to the instance if it got streamed in/out

#

Or I have no clue how the instance rpelication thingy even work

ruby crypt
#

It means the client gets the message before the instance has streamed in

pulsar cypress
#

o ic

#

ty

past dust
ruby crypt
past dust
#

Packet("ToggleELS", Packet.NumberU8 or Packet.String)

silent spire
#

or

past dust
#

Thought I could use that cuz the typechecker liked it 💔

#

So I have to do Packet.Any and cast it as number | string?

silent spire
#

yes

past dust
#

Welp

#

ty pooks

past dust
#

Vro 🥀

ruby crypt
past dust
#

Yeah, the type solver tricked me fr 😔

past dust
#

Is it possible to do ... as an argument?

tribal terrace
#

just do {packet.Any}

ruby crypt
upbeat cobalt
#

Why i suddenly started getting this Yield error.

#

From Packet Line 313

#

Sometimes it starts fast, other times it starts slow.

ruby crypt
# upbeat cobalt

if the server takes long to require packet then the client will wait for the server

#

make sure the server requires packet instantly

upbeat cobalt
#

Oh, i see thank you

upbeat cobalt
#

I faced another issue.

#

But im in fact calling for it

#

Its something wrong?

#

Oh, Nvm got the solution

torn torrent
#

im getting warning of dooms lol

ruby crypt
silent spire
ruby crypt
#

i think the type solver team plan to have stable type solver in 1 year

rain rock
#

@ruby crypt can we have a lot more error protection and better error messages against common issues

#

maybe idea for 1.8

ruby crypt
rain rock
ruby crypt
rain rock
ruby crypt
#

And after ro drone v3

rain rock
#

Oh god

#

Its never happening

#

🥀

ruby crypt
#

Linux based operating system

#

With a brand new user space

rain rock
ruby crypt
#

No I'm going to use the kernal directly

rain rock
#

Crazy

ruby crypt
#

Without making any changes

rain rock
#

So okay packet 2.0 never coming out

#

🥀

ruby crypt
#

Also after infinite terrain v2

pulsar cypress
rain rock
pulsar cypress
#
  1. make linux distro
  2. make programming lang
#

and after that to the main list

ruby crypt
#

It will have a brand new user space coded in soup

#

Apps will be sandboxed

#

It will be a little like android

pulsar cypress
#

suphi what langs do yk

#

fluently

ruby crypt
#

Lua

pulsar cypress
#

thats all? 😭

#

aint no way

rain rock
#

💀

past mist
silent spire
past mist
silent spire
#

remember there is a devforum post with docs

past mist
#

my bad im dumb

clever sand
#

SIMP!

mint laurel
rain rock
past dust
#

Yeah I hope Suphi was joking there 😭

clever sand
past dust
#

Double negative = positive

mint laurel
past dust
#

😭

mint laurel
thorny shard
#

ReplicatedStorage.Packages.Packet.Types:67: invalid argument #3 to 'writeu8' (number expected, got nil) - Client - Types:67
getting this when trying to fire from client to server

local activationPacket = Packet("ItemUsed", Packet.Instance)

    tool.Activated:Connect(function()
        activationPacket:Fire(tool)
    end)
thorny shard
#
    local activationPacket = Packet("ItemUsed", Packet.Instance)
    activationPacket.OnServerInvoke = function(player, tool:Tool)
        warn(`{player.Name} activated {tool}`)
    end
#

@tulip zephyr any idea whats causing this?

thorny shard
#

ignore lol

#

im an idiot

#

i forgot to initialize the server side

elder bone
#

Are your clients your employees too?

mint laurel
past mist
#

@ruby crypt should i add a rate limiter on server if Im using packet? in case people spam remotes and try to crash the server

silent spire
ruby crypt
past mist
ruby crypt
#

8000 / 800 = 10 events per heartbeat

past mist
#

oh yea i do see it

#

this is nice

#

do you think the server can normally handle 10 events in a heartbeat?

#

without crashing

ruby crypt
#

Server won't crash

#

I tested

past mist
#

okay thank you

#

ill just change the return to player:Kick() instead

ruby crypt
#

Ok

past mist
#

ill also do 4000 max

#

is that fine

#

?

shell shell
ruby crypt
#

Because lag spikes can make events arrive at the same time

past mist
#

okay thank you

ruby crypt
#

4000 / 800 = 5 events per heartbeat

past mist
#

yes thats good

#

will you be doing major updates in future?

#

in case u change code structure, etc

ruby crypt
past mist
#

okay thank you

#

what do you think

ruby crypt
gilded plank
#

What does this do?

past dust
#

"Networking Library"

mint laurel
#

what will ultimately be smaller to send through packet:

two smaller numbers (1x "U8" (1-10) & 1x "U16"), or one bigger number (1x "U16")

#

@ruby crypt 3DInnocent_

ruby crypt
mint laurel
#

first number 1-10.
second number the counter id

ruby crypt
#

well a u16 is better then a u8 + u16

mint laurel
#

though I realized even that counter id might go above 255

ruby crypt
#

but then is it really worth the hassle

mint laurel
#

so i bumped it to a u16

#

Originally they were both U8s tho

mint laurel
ruby crypt
#

merging them into 1 big number?

mint laurel
#

well it would essentially be just having one global item counter

#

and not splitting them off into sub groups

#

@ruby crypt forgive the ping..

rain rock
#

Thats it

ruby crypt
mint laurel
ruby crypt
mint laurel
#

So the instance needs to know the item it’s associated with so I can link it to it

ruby crypt
#

k

torn torrent
torn torrent
stone pasture
#

why is everything hashed sayori_sob

torn torrent
#

and the rest is just guid

#

unreliables were probably the most pain in the ass

#

init issues conflicting

torn torrent
#

as long as its unreadable on rspy, and somewhat hard to track packets even with decompiled bytecode

#

depending on the rspy they use, if they dont have autoformatting for names with dashes or space, then yeah GGs

#

shits never Firing

stone pasture
#

early signs of paranoia

stone pasture
#

@weary halo has to see this

torn torrent
torn torrent
#

if you wanna figure out my remotes, come and reverse engineer my hashing algorithm with jobid seeds!!!!

stone pasture
#

from the source

torn torrent
#

true but they would have to view the code

weary halo
#

or even better yet, leave like 500 remotes which do absolutely nothijg

torn torrent
#

this is as far as i can go codewise

torn torrent
weary halo
#

did you modify packet to you need

torn torrent
#

even my module names are hashed for no reason

#

to spice it up

#

probably obfuscate the code

#

but it could still be deobfuscated, but thats for the ones who genuinely live in a basement

weary halo
#

Though I think like its gonna hurt readability of error logs

#

😔

torn torrent
#

my code doesnt error!

weary halo
#

absolute lie

torn torrent
#

😔

weary halo
#

while at it, obfuscate the source code too

torn torrent
weary halo
#

with some paid obfuscation which nobody has access to de-obfuscate

weary halo
stone pasture
torn torrent
#

ok, ill figure it out

#

round 2

weary halo
#

why even send valid buffer data

#

just send hashed buffer

torn torrent
#

🤔

weary halo
#

scrambled buffer 🤑

#

you have to then guess correctly on how to unscramble it

stone pasture
#

a buffer with very specific instructions in how to deserialize 🔥

torn torrent
#

optimization ❌ unoptimization ✅

weary halo
#

To ensure buffer security, each payload takes 20 mb's

torn torrent
#

My ui is hashed, remotes are hashed, console is hashed,

weary halo
#

What is bro trying to gatekeep in his game

torn torrent
#

modules are hashed

#

The final step would be the workspace

torn torrent
stone pasture
#

i swear if it's a hangout game

torn torrent
weary halo
#

I thought you were storing your irl information because Ephyr blackmailed you into making the game

#

Only at Suphi Kaner server man

torn torrent
#

nah i lowkey left her alone on the rts

#

I jumped to the big leagues

#

Playing around with Cryptography

#

I still havent dropped my cryptography library using buffers

weary halo
#

I only now learned that Region3 size can be negative

#

LOL

torn torrent
#

i only went up to sha512

torn torrent
weary halo
#

I want to improve me old shelfed game, but im stuck on the whole terrain gen

#

(atleast I learned that you wont want to write voxels when region size is negative)

torn torrent
#

and then start development

#

u want everything as unreadable as possible

weary halo
#

let exploiters view my crib and then go "this is trash"

torn torrent
#

Or u can just genuinely write trash code like yarik

#

And then call it a day

#

Higher success rate of warding them off

weary halo
#

not even people who live in the basement would want to tinker with it

torn torrent
#

pray for me twin

#

implementing this might lowkey kill me

torn torrent
stone pasture
#

i need to see the outrageous results sayori_sob

torn torrent
#

thats a massive stretch

gloomy summit
torn torrent
torn torrent
#

@weary halo round 2, match the right order:

#

i actually pulled it off LMAO

stone pasture
#

but wow

#

@torn torrent don't you already have a bunch of encryption and cryptographic algorithms? just dupe the entire client and encode everything, since you can also decode it

torn torrent
#

too much work, dawg how am i supposed to script

#

is it even possible? ill have to use object values and shit

#

and genuinely torture myself with a custom require and getter methods that goes through decoding process just to get the name and get the object

#

and no more typechecks skull_sob

stone pasture
#

why stop now?

#

keep going

torn torrent
mint laurel
#

what ops do u have

#

whos coming after u

torn torrent
torn torrent
#

They want the super secret top files

mint laurel
#

I pay no mind to the invisible boogeyman of exploiters

#

it’s a Roblox developer psyop

#

to have developers waste time

weary halo
#

smh, your secret top file is 99% my work

torn torrent
#

The cult that hashes everything

#

Even down to raw source code

mint laurel
#

a single packet definition module seems odd for a whole game

torn torrent
mint laurel
thick atlas
#

is it not possible for dicitonaries in this library to use dynamic indexes?

like {[Packet.String] = Packet.String}

it'd be really handy cause using Packet.Any for dictionaries like this is really expensive

edgy valley
thick atlas
#

many sads

#

(wish i'd know how to help with ur problem but i don't work with packet enough to know)

past mist
#

i dont get how i can use static tyupes and enums

coral venture
#

what happens when i use a number bigger than its capacity based on its type?

safe aspen
rain rock
#

for eternity

#

or switch to single packets module that stores all packets in one place

#

which is then required by both server and client

safe aspen
#

alr thanks ill take a look at it

rain rock
safe aspen
# rain rock np!

one more questions i have some in one packets module and some just separate because they are for some reusable services i have, it should be of these where the error is coming from right?

silent spire
#

you can test easily

coral venture
coral venture
#

i hope it does

thick atlas
#

@ruby crypt I apologize for the ping but is there any possibility there's something in the library to sanitize given tables when using packet.any?

it doesn't support replication of things like functions but i think it should be capable of just not replicating something it doesn't recognize when using the any type instead of erroring

ruby crypt
thick atlas
hot steeple
#

Why is the "player" argument here considered as nil on client even tho on server it's not nil?

First image is server side
Second image is client side
Third image is how the packet look like

#

It works when the first player argument is not equal to that player argument, is this some kind of packet thingy?

rain rock
hot steeple
rain rock
ruby crypt
inland roost
inland roost
rain rock
#

any literally saves them as the type they are

inland roost
#

Interesting, I haven't done a deep dive into Packet as a module and was experimenting but that is a unique approach compared to the other ones

rain rock
#

it's pretty useful

inland roost
#

Yeah sounds like it, especially with quick debugging/changes to data

#

Nice feature

hot steeple
#

Do we know what values each of the types packet has, can handle?

#

so like what is the maximum value for numberu8 etc..

inland roost
hot steeple
#

Ohh okay okayt thx

rain rock
#

you can look it up online

#

but it's basically [0, 255]

hot steeple
#

Packet should have a built in fireallclients

clever sand
#

ngl

hot steeple
rain rock
#

:Fire

hot steeple
#

thx goat

#

I didn't know

#

lmao

hot steeple
#

I have a question

#

Imagine you set the type as numberu8. firing "12" or "250" will have a network usage difference?

#

Or they're all same as long as it stays in the range

#

which for a numberU8 it's 0 - 255

silent spire
#

numberU8 is always a byte

hot steeple
#

One of the argument I pass in a packet event is Nil on client for some reason but isn't on server, why is that?

Client (First Image) :

Server (Second Image) :

Output (Third image) :

#

Because of streaming enabled maybe?

past dust
sand fern
#

highly plausible

thick atlas
#

Astonishingly plausible