Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Basic spawn function won't work?

Asked by
Discern 1007 Moderation Voter
9 years ago

I was messing around with coroutines/spawn in ROBLOX Studio, and this script happened to not work.

There is no errors being printed in the Output.

The hint just keeps being destroyed and created endlessly. No numbers are being printed in the Output. The value that a is should be printing every second.

local a = 0

function myNewThread()
repeat
    local h = Instance.new("Hint", game.Workspace)
    h.Text = "This is a hint!"
    wait(1)
    h:Destroy()
    wait(1)
until
    a >= 10
end

spawn(myNewThread())

while true do
    a = a + 1
    print(a)
    wait(1)
end

Thanks in advance.

Answer this question