This commit is contained in:
EternityDev 2024-11-30 23:55:07 +07:00
parent 925df47d4c
commit d065bc2e50
3 changed files with 5 additions and 7 deletions

BIN
Warp.rbxm

Binary file not shown.

View file

@ -232,12 +232,11 @@ function ClientProcess.start()
end) end)
local function onClientNetworkReceive(Identifier: buffer | string, data: buffer, ref: { any }?) local function onClientNetworkReceive(Identifier: buffer | string, data: buffer, ref: { any }?)
if not Identifier or typeof(Identifier) ~= "buffer" or not data or typeof(data) ~= "buffer" then return end if not Identifier or typeof(Identifier) ~= "buffer" or not data or typeof(data) ~= "buffer" then return end
Identifier = Buffer.convert(Identifier :: buffer) Identifier = Buffer.convert(Identifier)
local idx: string = registeredIdentifier[Identifier] if not registeredIdentifier[Identifier :: string] then return end
if not idx then return end
local read = Buffer.read(data, ref) local read = Buffer.read(data, ref)
if not read then return end if not read then return end
local callback = clientCallback[idx] local callback = clientCallback[Identifier :: string]
if not callback then return end if not callback then return end
for _, fn: any in callback do for _, fn: any in callback do
Spawn(fn, table.unpack(read)) Spawn(fn, table.unpack(read))

View file

@ -306,11 +306,10 @@ function ServerProcess.start()
local function onServerNetworkReceive(player: Player, Identifier: buffer | string, data: buffer, ref: { any }?) local function onServerNetworkReceive(player: Player, Identifier: buffer | string, data: buffer, ref: { any }?)
if not Identifier or typeof(Identifier) ~= "buffer" or not data or typeof(data) ~= "buffer" then return end if not Identifier or typeof(Identifier) ~= "buffer" or not data or typeof(data) ~= "buffer" then return end
Identifier = Buffer.convert(Identifier :: buffer) Identifier = Buffer.convert(Identifier :: buffer)
local idx: string = registeredIdentifier[Identifier] if not registeredIdentifier[Identifier :: string] then return end
if not idx then return end
local read = Buffer.read(data, ref) local read = Buffer.read(data, ref)
if not read then return end if not read then return end
local callback = serverCallback[idx] local callback = serverCallback[Identifier :: string]
if not callback then return end if not callback then return end
for _, fn: any in callback do for _, fn: any in callback do
Spawn(fn, player, table.unpack(read)) Spawn(fn, player, table.unpack(read))