Hey, I’m Park and I am having problems with a function I made
Error:
Players.vParkuu.PlayerGui.ScreenGui.Frame.LocalScript:83: Script timeout: exhausted allowed execution time
Script:
local function NovaLetra(Quantidade)
local Criadas = 0
repeat
local Pos1, Pos2 = Random.new():NextNumber(0.028, 0.896), Random.new():NextNumber(0.085, 0.67)
local Numero = math.random(1, #Alfabeto)
local Letra = Alfabeto[Numero]
local Clone = Template:Clone()
Clone.Parent = Buttons
Clone.Position = UDim2.new(Pos1, 0, Pos2, 0)
Clone.Text = Letra
if #Buttons:GetChildren() > 1 then
for _, Botoes in pairs(Buttons:GetChildren()) do
if (Clone.AbsolutePosition - Botoes.AbsolutePosition).magnitude > 52 then
PodeAdd = true
else
PodeAdd = false
break
end
end
else
PodeAdd = true
end
if PodeAdd then
Criadas += 1
Clone.Visible = true
Clone.Name = Letra
table.insert(Selecionados, Numero)
else
Clone:Destroy()
end
until Criadas == Quantidade
table.sort(Selecionados,
function(A, B)
return A < B
end
)
end
Any help is appreciated
– Park