diff --git a/src/Index/Util/Serdes.luau b/src/Index/Util/Serdes.luau index 08b619e..a38a0a4 100644 --- a/src/Index/Util/Serdes.luau +++ b/src/Index/Util/Serdes.luau @@ -20,13 +20,15 @@ return function(Identifier: string, timeout: number?): number task.spawn(yieldThread, nil) error(`Serdes: {Identifier} is taking too long to retrieve, seems like not replicated on server.`, 2) end) - while coroutine.status(cancel) ~= "dead" and task.wait(0.5) do -- let it loop for yields! - if (Event:GetAttribute(Identifier)) then - task.cancel(cancel) - task.spawn(yieldThread, Event:GetAttribute(Identifier)) - break + task.spawn(function() + while coroutine.status(cancel) ~= "dead" and task.wait(0.5) do -- let it loop for yields! + if (Event:GetAttribute(Identifier)) then + task.cancel(cancel) + task.spawn(yieldThread, Event:GetAttribute(Identifier)) + break + end end - end + end) return coroutine.yield() -- yield end return Event:GetAttribute(Identifier)