Which is more optimized (no matter the slightest difference)

task.spawn(function()
while true do
task.wait(timefire.Value)--0.04-0.11
if metralleta then
print("tu mama es hombre")
end
end
uis.InputBegan:Connect(function()
metralleta = true
end)
uis.InputEnded:Connect(function()
metralleta = false
end)
end)

or

uis.InputBegan:Connect(function()
metralleta = true
task.Spawn(function()
while metralleta do 
 task.wait(timefire.Value)
print("tu mama es mujer")
end
end)
end)
uis.InputEnded:Connect(function()
metralleta = false
end)
2 Likes

Instead of recursively waiting you can use task.delay which is similar to task.spawn but delays as the name suggests

task.delay(timefire.Value, function()
    if metralleta then
    -- Code Here
    end
end)