From 42f2c6b35e842eedb9843ad495aaa60f76d3d691 Mon Sep 17 00:00:00 2001 From: xArshy <6077173+xArshy@users.noreply.github.com> Date: Sun, 31 Mar 2024 00:26:42 +0400 Subject: [PATCH] Update Serdes.luau Added a timeout of 10s plus a warning. --- src/Index/Util/Serdes.luau | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Index/Util/Serdes.luau b/src/Index/Util/Serdes.luau index d71743b..d3419b2 100644 --- a/src/Index/Util/Serdes.luau +++ b/src/Index/Util/Serdes.luau @@ -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 \ No newline at end of file +end