mirror of
				https://github.com/imezx/Warp.git
				synced 2025-11-03 19:49:16 +00:00 
			
		
		
		
	Update RateLimit.luau
Prevent halting of the code execution.
This commit is contained in:
		
							parent
							
								
									0fb349fe0f
								
							
						
					
					
						commit
						ed73b66dc9
					
				
					 1 changed files with 9 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -13,11 +13,14 @@ function RateLimit.create(Identifier: string, entrance: number?, interval: numbe
 | 
			
		|||
		Event:SetAttribute(Identifier.."_ent", entrance)
 | 
			
		||||
		Event:SetAttribute(Identifier.."_int", interval)
 | 
			
		||||
	else
 | 
			
		||||
		while (not Event:GetAttribute(Identifier.."_ent")) or (not Event:GetAttribute(Identifier.."_int")) do
 | 
			
		||||
			task.wait(0.5)
 | 
			
		||||
		end
 | 
			
		||||
		entrance = tonumber(Event:GetAttribute(Identifier.."_ent"))
 | 
			
		||||
		interval = tonumber(Event:GetAttribute(Identifier.."_int"))
 | 
			
		||||
		task.spawn(function()
 | 
			
		||||
			repeat 
 | 
			
		||||
				task.wait(0.5)				
 | 
			
		||||
			until Event:GetAttribute(Identifier.."_ent") or Event:GetAttribute(Identifier.."_int")
 | 
			
		||||
			
 | 
			
		||||
			entrance = tonumber(Event:GetAttribute(Identifier.."_ent"))
 | 
			
		||||
			interval = tonumber(Event:GetAttribute(Identifier.."_int"))
 | 
			
		||||
		end)
 | 
			
		||||
	end
 | 
			
		||||
	local entrances: number = 0
 | 
			
		||||
	return function(incoming: number?): boolean
 | 
			
		||||
| 
						 | 
				
			
			@ -31,4 +34,4 @@ function RateLimit.create(Identifier: string, entrance: number?, interval: numbe
 | 
			
		|||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return RateLimit :: typeof(RateLimit)
 | 
			
		||||
return RateLimit :: typeof(RateLimit)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue