mirror of
https://github.com/imezx/Warp.git
synced 2025-04-24 07:00:03 +00:00
Update Serdes.luau
Added a timeout of 10s plus a warning.
This commit is contained in:
parent
ababd89359
commit
42f2c6b35e
1 changed files with 12 additions and 3 deletions
|
@ -15,9 +15,18 @@ return function(Identifier: string): number
|
|||
--Event:SetAttribute(Identifier, string.pack("I1", SerInt)) -- I1 -> 255 max, I2 -> ~ 6.5e4 max. (SerInt)
|
||||
end
|
||||
else
|
||||
while not Event:GetAttribute(Identifier) do
|
||||
task.wait(0.5)
|
||||
local loaded, timedout
|
||||
task.delay(10, function()
|
||||
if loaded then return end
|
||||
timedout = true
|
||||
warn(`{Identifier} is taking too long to retrieve.`)
|
||||
end)
|
||||
|
||||
while not Event:GetAttribute(Identifier) and not timedout do
|
||||
task.wait(0.5)
|
||||
end
|
||||
loaded = true
|
||||
if timedout then return end
|
||||
end
|
||||
return Event:GetAttribute(Identifier)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue