#Packet - Networking Library
1 messages · Page 2 of 1
Well it has always used that but I should probably switch to defer
if disconnect while looping the item at the back will move and then you could skip that last item
if it moves before the current index
Swapback arrays work like this:
When you want to remove something, instead of removing a certain index and moving the entire array, you just swap the last value with the value you want to remove.
{1, 2, 3, 4, 5}
-- Remove index 3 with swapback method:
{1, 2, 5, 4}
Just more efficient array removal. Only downside is it is not ordered.
yer so imagen your looping and your at index 3 and swap 5 to index 2
now your fire will skip 5
yup
For certain scenarios at least
yer but because the connect order is random you never know if its safe to disconnect a connect when a event is fired
also if you have once
and your once disconnects instantly
it could have the same problem
also wait could also have problems
Yea wait is basically a once connection
yer so if you move it into the current index do you fire the same index again?
before moving upto the next index
Nah I move up
That works at least
They can disconnect themselves but not others then it will break
do you remove it in the same thread during looping
Yep
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
You can see my code here btw.
if your defering this function then it should be fine
@ruby crypt Is it required to use Packet.Nil or can I just input nothing?
Just put nothing
If u dont pass anything in as variable
oh skibidi toilet
packet.Nil is kinda useless it only allows you to send nil nothing else
But can I do
Packet("Packet")
yes you can do that as well
Oh great
I don't know why it exists 
me 2
but we need it for any
oh
that makes sense
so it's just a result of internals
not really
any uses a separate function for nil
btw did you see NetRay and also glad packet is getting more recognition amongs the community
Im already hearing about packet on any network library discussion
I know net rays used my code from the first versions of packet
yeah really bad of them to not credit
before I merged it into 1 module
I mean the license says it's free of charge but I don't like people that doesn't credit
but I don't know if netray still uses my code
I think he rewrote
after getting lot of hate
I did not know glad packet existed
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
buffers have built in compression
yeah but he was measuring with packet profiler
which cant see the compression from roblox
right
no nothing can see it
only the network thing built into studio
ah I see
the Network stats in studio
well he never used that but I might test it again with that
his library was around 2x slower I believe due to heavy compression
but without compression it was p much same
Packet being a little slower
Does Packet support unreliable remote events?
How?
u just copy paste the code in the forum
it's just a wrapper
Ah yes I see now. It's basically just Packet serialization and deserialization.
And normal UnreliableRemoteEvents otherwise.
yes
yup its a way to support unreliable without adding any extra complexity to the packet module
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?
yeah I think so
ye it checks how big the number is
its pretty easy to check in the source code
yes also if you do
-255 it will still use a numberU8
:O
That is amazing
Then why not always use Packet.Any over anything else?
because the sign of the number is saved in the type byte
because any adds a extra byte
Oh a full extra byte damn
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
for any you also need to do sanity checks
while if you use a fixed type for example u8 its guaranteed to be a number in 0-255 range
Of course, but I'm not too worried about that.
That's minor CPU usage.
Unnoticable at a realistic scale.
i mean i like it more cuz it makes your code cleaner by not adding checks everytime
cpu usage is not a concern ye
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)
based on the error message you have not set it up
this means the packet is not found so it was not setup yet
What's the fix then? I have set them up way before but it seems for some reason the piece of code is running before they even get set up fully
Task.defer?
add prints when you set them up and see if it prints before or after the error
then change the order of your code so that it sets up before the error
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?
set the function at the top of the script
right after I require the packets module?
right or if your not requiring the module anyware else you can move it down
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
set the function at the very top
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
where is your script located in
my local script is in starterplayerscripts and my serverscript is in serverscript service
try adding a delay before client
like task.wait(2)
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
alr
yeah you need to fire once
The event fired twice because the event was connected multiple times
I went to bed to deal with it today after my appointment
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
thanks for your help, didnt realize the command bar counted as a separate place to require
fixed the client side, now working on the server side not seeing a response thread for some reason
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
everything works ok to me
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
if it was not there then somthing else consumed it
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
U store client in RS?
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?
is type checking working?
this isnt part of the api but it wouldnt be too difficult to implement in your own code in some way
whats your use case for disconnecting events?
I don't really have any case, just being curious
local p = Packet("Name")
local connection = p.OnClientEvent:Connect(MyFunc)
connection:Disconnect()
Where am I supposed to store it?
Playerscriptsstorage
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
replicated storage is better imo
wtf is that
You were about this close:










why is that an emoji bro 😭
Apple
wouldnt it be easier if you could just put all your remotes in a module in replicated storage?
yes
That is legit what most people are doing
btw
adding this wont cause any read/write problems right? (trying to suppress an error)
no it wont but you're dropping events just be aware
it is supposed to error so you dont drop events
as long as you're aware it's fine to patch it like this
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
well in that case you can patch your packet safely
wait so will it not error if i require the packets before yielding for the player to load?
yes, if you require all your packets without yielding
it will work
oh i thought it was based on when i setup the receiving connection
yeah no as long as you require every single packet in one go without yielding it should never error
nor drop events
k thanks
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
if there are frequent events you have to use a network library
batching and serialization will probably help a lot
Do you know if there’s a server CPU hit with a lot of players?
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
I’ll give it a go and come back if I have any issues
aight
servers get more powerful as more players join
afaik
but packet should never hit any of these limits
it is quite fast
@ruby crypt how do i add new types and enable dynamic typechecking for 1.7?
add new types inside the types module
runtime type checking was removed
as in around here?
yes
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
then you can use the static type
you can rename, clone or copy one of the static types
ok ill try that
does this mean ill have to create my own function for it?
umm i dont really understand what your asking for
something like
assert(packet:Check("string", 1234, true), "Types dont match")
yh something like that i was refering to
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
ty ill try out what said
wait so if i had a type that looked like this, ill just copy whats done for the cframe and string types, and combine them?
you can put any value inside static
even tables right? lol
which is kinda powerful icl
yes
if a script holding the .OnClientEvent or .OnServerEvent is deleted, does the connection still exist?
yes
Is there a way to make them delete themselves from script deletion?
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
add a Bindable event somewhere
then have a master connection that never gets deleted this master connection job is to just fire the Bindable event
then make the scripts that get deleted only connect to the Bindable event
i see now thanks
you could even modify the signal module to call the Bindable event
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
I'll check it out when I get home if you could send me the broken code it will help me find it quicker
I like to code
okay Ill try to recreate
it's been a while I dont remember
But it was :Wait
I can't seem to recreate it right now unfortunately 🥀
we're good until it happens again
maybe was you cancelling the thread
might be I dont remember
it will try to resume the cancelled thread and error
stopping all the other connection from firing
there wasn't errors tho afair
then I have no idea
do OnServerInvoke connections also stay even on script deletion
is it possible to make these connections auto delete if the script they're in no longer exists
only bindable events can do that
@ruby crypt if you send really large value into a Packet, it can fire completely other random Packets
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
Is there a way to default to only use StringLong for Packet.Any to stop random packets from being able to fire
strings only allow 255 characters
longstrings allow 65,535 characters
when you use any it defaults to string not long string
you have to edit the types module
so when you go above the 255 it just fires random packets
it overflows the characters and you will get random things happen
couldn't an exploiter bypass this limit and continue to send random long strings which would cause the random things to happen
something else that was really weird is something it would teleport everyone on the map to the center of the world
feels like something you should check for considering how easy of an exploit that is
a exploiter can send any infomation they want
and as many packets as they want
you dont even need a client for it
actually that is true mb
but is there anything that would cause every player on the map to be tped to the center
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
not with packet
but if the data overflows then the events parims will have random values
ok thanks
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)
how would i know what values are meant to be sent
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
would you still need the check you could just do input = string.sub(input, 1, 255) by default
or is that bad idk
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
does the type of the value you send change?
if you just send a big string just use Packet.LongString instead of Packet.Any
it uses Packet.Any since it can but ill change it to be purely numbers
you send like the soundID? how do you change the "boombox audio"
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
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
which causes undefined behavior due to how batching works
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
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?
yes, because if an overflowed character is read as a valid packet id, itll read whatever bytes come after as its own types, not as a string
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
Is there any way to check what Packet was being fired by name for testing reasons through a print statement
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
does that mean that every packet can receive random values and types?
so you still need to check if its the correct type and in valid range?
you dont need to check the types, packet will read the bytes as whatever type it wants, whether it was originally valid or not
@ruby crypt is this possible
trying o find what random packet just tps every player to the middle of nowhere 😭
i dont know what that means
Whenever a Packet is Sent, it prints the Packet Name in Output
may be try packet profiler
you can see the most recent event after players tp (i realized it wont help)
you would need to modify the fire funcition
doesnt packet use one remote event
so its still a guarantee the type is correct?
like
local SomePacket = Packet("Test", Packet.String)
SomePacket.OnServerEvent:Connect(function(thing)
-- so "thing" will ALWAYS be a string, otherwise this wont fire?
end)
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
ok good
and if you use Any, you have to do your own type validation
i always liked that you didnt have to check the type
or static right
cuz static can be anything that you put in it
static i would hope you know the types for considering you put your own values in a table that it can choose from

o yeah i can't see the name of them rip
may be use find all and search like ":Fire"
😭 i have 100s of packets im fried
320+ish
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
ye im trying to find it now im just very lost ngl
and from the id you can get the name
are you sure the tp is from a server -> client packet?
Actually it'd be better to add a print for OnServerEvent
the actual firing isnt there, its at the bottom cuz of batching
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
isnt there 256 packets max
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
yea well its 256 max
you can increase it to 65k but it will use 2 bytes instead of 1 for packet id
totally makes sense. If they fire random packets why not fire them like the way you want
they can always do that
unless you use any
ok i found it Hooray!
It's on a OnClientEvent
this this fires randomly
if u send insanely larger number
number or string
i think its a string of numbers
i was sending the bottom through a Packet.Any5409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995540936099554093609955409360995
with any a very large number is sent as a 64 bit float it will never overflow
right but is it
value = 5409360995540936099554093609955409360995540936099554093609955409360995540936
or
value = "5409360995540936099554093609955409360995540936099554093609955409360995540936" -- im guessing its this one
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
if you do that you might lose some numbers
you should send it as a longstring
or if you still want to use any you have to make the change i showed above
the number isn't meant to be so long anyways, i'll cut the amount that's sent over thanks for the help
are you using new type solver
i think so
well its in beta for a reason
new type solver?
yeah
packet was written in old type solver
fix beta type solver 🙏
once the new one comes out of beta it should work but if it does not then ill look into it
or we send a bug report to roblox telling them to fix the problem
okay
hopefully once the new one comes out of beta its fully compatible with the old version
btw can i message you in dms about some questions
i hope so too
you can message me questions in the server
k but im going offline now
kk
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
you need to set the same response on the client side as well
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)
packet.Any : Instance?
So.. no?
Optionals kinda don't make sense in a serialization context if you think about it
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
so yes there is no difference in data usage between any and optional
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
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
?
sorry my game got backdoored i'm thinking of every possibility on how it could've happened
more likely some free model asset
have u tried
ctrl shift f keywords
require
loadstring
:PostAsync
ye, but i think i foudn the issue, had to do with loadasset i think
not entirely sure yet tho
suphi does not run loadstring on a serialized packet. Also serialized packets will error if they don't evaluate to correct type
(or in the case of BitStruct, one additional bit per nullable type)
but then you only have primitive types for now
smart ahh
(I didn't get it btw)
that one packet addon i made a while back
oh yeah bitstruct
whats this mean, is it normal? I see it in Luauheap
what even is this
im checking for memory leaks via LuauHeap, and I notice a lot of this
which is referring to this
it's recycling threads
not a mem leak
ok thanks
does packet.any with optional type serialize? or no(i forgot)
yes it serialises but not as optimal as defining the type
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
bro what is wrong with this
the thread waiting for a response was not found
not sure why your getting that
the thread on client it means?
thread is signal that is supposed to be fired when response received or
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
Yes that's what happens because server launched somewhy too delayed
Yep it does task.wait(.1) till some variable found
Only happened in studio tho but still weird
yer the server should not wait and return the information instantly
What if its necessary?
then think of another way to do it
Hmm ic
why does echo have invoke
Hey, I was wondering what's the difference between the 3 CFrame types and which should be used for a character's CFrame?
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
(reverse the order of the numbers on the right)
CFrame 12 gives bad range and rotation is also limited
yeah mb
@drifting mountain If you just need roblox accurate cframe I would use CFrameF32U16
you have a typo in the names
roblox is slightly less accurate then F32U16 while using more data
if I remember correctly
yea I remember that
but still closest to roblox
very close right?
I kinda remember your tests
I can't remember
packet beta testing was so fun
I'm so glad I could participate
🔥
what does "limited" mean?
like less precise or it doesnt replicate past some value
bad wording
for position it's actually limited
for rotation it's less precise
ic
the error is probably with the
scripts load later.
you need to declare packets at start
Should I have a separate script that runs on plr join?
that instantiates the packets
you could create a "Packets" Module where you store the packets
you shouldnt yield all scripts because something is loading
I shouldn't run all scripts on join either, what are you suggesting?
why do you need scripts to run/load "later" and why cant they run at start
Because they don't need to, they're inside of StarterGui
that didnt help
It works but the module is required by the same scripts that load later, so it can't be that
you dont need to just require packet, you need to define the packet by the same name on server and client
you could create a Packets module like this
-- Packets module
local Packet = path_to_packet
return {
dosomething = Packet("DoSomething", Packet.Any),
requestsomething = Packet("RequestSomething", Packet.Any, Packet.Any)
}
that way you only define it once and it way more convenient
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
make a module that initializes all packets and require it in a script on both client and server
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
thx
No, you suck
🙏 pin
oops forgot to disable mention
hi sinek
what do you mean by "Initialize all packets on the same frame Packet module is required for the first time (started)", what would that look like
i already use something like this, as this is how I define all my Packets
not sure if thats what you mean
it means initialize them on the same frame
what's so confusing about that
this code runs on the same frame
✅
On the frame scripts start?
yeah
could someone tell me what this means and what the cause could be? this hasnt happened before
probably exceeded max live threads
This could be because the server or client is responding to late do you have a delay on your invoke functions
Or maybe your script gets destroyed before the server/client can respond
No delays in my invoke functions and no script deleting
Well its saying that it can't find the thread that was waiting for a response
you think it could be coming from fetching datastore keys from a player? (using ur datastore btw)
Its coming from return settings and return saved outfits
When do you fire them packets
When a player joins
When the module loads that fires the packets*
they get fired instantly, should i make it wait a bit before firing?
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
Okay
Is this error also related to the warning above?
Most likely
Are you sending a huge amount of data or something
Not really
highest would be a table with 3-4 keys
What is line 309
One moment
Hm okay
Does this happen every time?
Not really
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
I don't know
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
@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
That means the instant does not exist for the client yet
If i can see it in workspace
This happens because of content streaming
You're right streaming is on but sending over the part's name and doing :FindFirstChild works
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
If you temporarily turn content streaming off does it work with packet
Let me see
Yeah it does
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
It means the client gets the message before the instance has streamed in
Erm
How did you define the packet
Packet("ToggleELS", Packet.NumberU8 or Packet.String)
or
Thought I could use that cuz the typechecker liked it 💔
So I have to do Packet.Any and cast it as number | string?
yes
Vro 🥀
You have to do
Packet.Any :: number | string
Yeah, the type solver tricked me fr 😔
Is it possible to do ... as an argument?
local p = Packet(name, {Packet.Any})
p:Fire({...})
Why i suddenly started getting this Yield error.
From Packet Line 313
Sometimes it starts fast, other times it starts slow.
if the server takes long to require packet then the client will wait for the server
make sure the server requires packet instantly
Oh, i see thank you
I faced another issue.
But im in fact calling for it
Its something wrong?
Oh, Nvm got the solution
aer you gonna plan on releasing an updated version that supports the new typesolver eventually?
im getting warning of dooms lol
Yes once all the type solver bugs are fixed
we're gonna get gta6 before stable type solver
i think the type solver team plan to have stable type solver in 1 year
@ruby crypt can we have a lot more error protection and better error messages against common issues
maybe idea for 1.8
Sounds like 2.0
So you're gonna do it?
After soup and suphi OS
What is suphi os
And after ro drone v3
Youre gonna make a fork?😭
No I'm going to use the kernal directly
Without making any changes
Also after infinite terrain v2
Another side project
Sheesh
No its not a destro
It will have a brand new user space coded in soup
Apps will be sandboxed
It will be a little like android
Lua
can you add fire all clients to packet
:Fire()
fire all clients not fire bro
remember there is a devforum post with docs
my bad im dumb
SIMP!
Wait what
wdym wait what 💀
Yeah I hope Suphi was joking there 😭
don't ever waste no diamonds on a hoe
Double negative = positive
I’ve been looping through players n doing fireclient
😭
it’s not that bad..
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)
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?
trace
Wait how do you fire your clients?
Are your clients your employees too?
@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
packet already has that iirc
Packet has one built in but you can tune it
I can help you tune it
is it this? i see it only prevents from sending incredibly large buffers tho, not just spamming :FireServer
It does also prevent spamming because we clamp each event to 800 bytes
8000 / 800 = 10 events per heartbeat
oh yea i do see it
this is nice
do you think the server can normally handle 10 events in a heartbeat?
without crashing
Ok
Just Fixed the bug, srry it was coming form Our internal server since We forgot to implement auto server initialization 👍
Yes that fine but makesure you allow around 5 events per heartbeat
Because lag spikes can make events arrive at the same time
okay thank you
4000 / 800 = 5 events per heartbeat
yes thats good
will you be doing major updates in future?
in case u change code structure, etc
Currently not planned
Seams OK to me
What does this do?
"Networking Library"
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 
when you say 2 small numbers why is the second number the same size as the big number?
well, I was doing counters for Ids. And trying to keep the counters low so I split them into sub groups.
first number 1-10.
second number the counter id
well a u16 is better then a u8 + u16
though I realized even that counter id might go above 255
but then is it really worth the hassle
What is worth the hassle
merging them into 1 big number?
well it would essentially be just having one global item counter
and not splitting them off into sub groups
@ruby crypt forgive the ping..
Just send both in the same packet
Thats it
both are fine i think your over thinking it pick the one thats works better with your systems
I do. But I also have to make it an attribute. Two ID attributes on the instance. I could instead just have one larger counter Id that is wholly unique, with one attribute.
why not just use the instance as the id
The instance is linked to an Item. But the instance won’t always exist but the item always will.
So the instance needs to know the item it’s associated with so I can link it to it
k
I dont get it realy
https://gyazo.com/b62b4dbcf1b801b68a499a1e79d2d1a3 am I being too paranoid?
of what
of what
i started hashing stuff lol
how did you get your packet to look like this?
why is everything hashed 
fuckton of bitshifting, i atleast screwed up the packet ordering 20 times, ive had issues with undeterministic outputs, but yeah
and the rest is just guid
unreliables were probably the most pain in the ass
init issues conflicting
idk tbh
as long as its unreadable on rspy, and somewhat hard to track packets even with decompiled bytecode
https://gyazo.com/d43a93224340c5c2e2a4834c2f3b3b8f they would have a field day with this one
depending on the rspy they use, if they dont have autoformatting for names with dashes or space, then yeah GGs
shits never Firing
early signs of paranoia
@weary halo has to see this
Lion doesn't concern himself with stopping exploits
death to rspy 
if you wanna figure out my remotes, come and reverse engineer my hashing algorithm with jobid seeds!!!!
well they could just fire it directly
from the source
true but they would have to view the code
Honeypot remotes
or even better yet, leave like 500 remotes which do absolutely nothijg
this is as far as i can go codewise
wait until u see my developer console 🔥
nah this so fucked LOL
did you modify packet to you need
at this point ill just start hashing everything
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
my code doesnt error!
absolute lie
😔
lets play a game, you have to match them
with some paid obfuscation which nobody has access to de-obfuscate
those exists?
in the same order as it was declared
modify packet so that the order aren't numbers but somehow hashed
ok, ill figure it out
round 2
🤔
a buffer with very specific instructions in how to deserialize 🔥
optimization ❌ unoptimization ✅
To ensure buffer security, each payload takes 20 mb's
Keep in mind i also have a character corrector on the server
My ui is hashed, remotes are hashed, console is hashed,
What is bro trying to gatekeep in his game
Epstein files
i swear if it's a hangout game
I thought you were storing your irl information because Ephyr blackmailed you into making the game
Only at Suphi Kaner server man
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
i only went up to sha512
I genuinely never touched Region3
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)
Hash everything
and then start development
u want everything as unreadable as possible
Or u can just genuinely write trash code like yarik
And then call it a day
Higher success rate of warding them off
Do whatever you do and then write genuinely most horrible code ever
not even people who live in the basement would want to tinker with it
https://gyazo.com/ee34fad9cc8c74c39ad70942d0e686c2 i found my answer 🔥
pray for me twin
implementing this might lowkey kill me
would have to call @past dust
if you finish this, I'll rank you above bytenet guy, zap guy, and even the blink guy
i need to see the outrageous results 
one day
thats a massive stretch
What type of fucking level are you on
coke, tbh idfk. i just randomly had the idea of trying to hash stuff recently. packet was just one of them
this is so stupid 😭
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
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 
Too much free time and bored 😭
Sinek and 6inch9inch
They want the super secret top files
I pay no mind to the invisible boogeyman of exploiters
it’s a Roblox developer psyop
to have developers waste time
I never hashed my shit
smh, your secret top file is 99% my work
Start a cult to counter yarik
The cult that hashes everything
Even down to raw source code
a single packet definition module seems odd for a whole game
the rest are honeypot packets
?
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
Could anyone look at my thread on #1017021795330699334 ? https://discord.com/channels/909926338801061961/1464790819759194333
Yeah you can't
many sads
(wish i'd know how to help with ur problem but i don't work with packet enough to know)
i dont get how i can use static tyupes and enums
what happens when i use a number bigger than its capacity based on its type?
I made my entire game and found out this problem later, is there a way I can find from which packet the error is coming from?
welp I have bad news. You can either use the debugger tool to inspect the packet id each time it errors
for eternity
or switch to single packets module that stores all packets in one place
which is then required by both server and client
alr thanks ill take a look at it
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?
i think it wraps around
you can test easily
i think so too
@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
In the types module close to the bottom you can modify the any type or check if a function exists before trying to call it
bit lost in which part of the module i'm supposed to use for this,,,,
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?
try sending it with a normal remote 🙂
I just think it's an auto feature inside packet for anti exploiting
That doesn't exist to my knowledge
I think this is content streaming if you turn that off it might start working but you should still keep it on even if it fixes the problem and use the child added event instead
Hey Suphi is it possible to use dynamic keys with dictionaries with Packet?
Example being:
{ [Packet.String] = Packet.Instance }
Packet.Any does the same thing
Well I noticed some of them like Blink or Zap allow you to so I was curious
they do that cuz they don't have any
any literally saves them as the type they are
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
it uses a system that self encodes the types with a little bit of overhead for each object
it's pretty useful
Do we know what values each of the types packet has, can handle?
so like what is the maximum value for numberu8 etc..
Its the same as documented in the buffer library, also similar to other languages, and it can be found in the types module I think, that or one of them commented at the beginning od the file.
Ohh okay okayt thx
it's an 8bit unsigned integer
you can look it up online
but it's basically [0, 255]
Packet should have a built in fireallclients
where!
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
no difference
numberU8 is always a byte
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?
Very plausible
highly plausible
Astonishingly plausible