Update RateLimit.luau

Prevent halting of the code execution.
This commit is contained in:
Bl4ise 2024-05-02 12:55:31 +02:00 committed by GitHub
parent 0fb349fe0f
commit aaaf8c373a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,11 +13,13 @@ function RateLimit.create(Identifier: string, entrance: number?, interval: numbe
Event:SetAttribute(Identifier.."_ent", entrance) Event:SetAttribute(Identifier.."_ent", entrance)
Event:SetAttribute(Identifier.."_int", interval) Event:SetAttribute(Identifier.."_int", interval)
else else
while (not Event:GetAttribute(Identifier.."_ent")) or (not Event:GetAttribute(Identifier.."_int")) do task.spawn(function()
repeat
task.wait(0.5) task.wait(0.5)
end until (not Event:GetAttribute(Identifier.."_ent")) or (not Event:GetAttribute(Identifier.."_int"))
entrance = tonumber(Event:GetAttribute(Identifier.."_ent")) entrance = tonumber(Event:GetAttribute(Identifier.."_ent"))
interval = tonumber(Event:GetAttribute(Identifier.."_int")) interval = tonumber(Event:GetAttribute(Identifier.."_int"))
end)
end end
local entrances: number = 0 local entrances: number = 0
return function(incoming: number?): boolean return function(incoming: number?): boolean