guys it was a bad example stop talking about the events
ok so it works, but that corountine stops when the second event comes in so it dont work for me do you know what can i do about it
Hmm, I’m a bit unsure what you mean. What’re you trying to do?
ok i’ll try to solve it by my self for a little more one min
ok so i couldnt find any working solution and its rily late for me so i’ll go to bed now. thanks alot i will aprove you answer cuz it was basicly what i need. and also that dude that was helping me for 40 minutes without even understanding the question was awesome ty to you too lol
I know this is late, but for anyone else who stumbles upon this forum, a possible solution is to use coroutines, but in a different way. Here is a code snippet:
TypeText = function(text)
while #text < 50 do
text = text .. "help me"
print(text)
end
end
TypeTextTwo = function(text)
while #text < 50 do
text = text .. "ghghghg12312"
print(text)
end
end
local typeTextCoroutine = coroutine.create(TypeText) -- Do not add the parameters inside of this, this also means you shouldn't add the parenthesis after the function call
local typeTextTwoCoroutine = coroutine.create(TypeTextTwo)
coroutine.resume(typeTextCoroutine, "Example Text") -- Any parameters are added in here after the comma, every parameter is after another comma
coroutine.resume(typeTextTwoCoroutine, "Example Text 2")
print("The loops don't affect me!")
By using this method, you can create a coroutine to basically start a new thread that doesn’t affect the rest. A similar method can be used for task.wait(). Instead of using task.wait(), you can use task.delay() to create a coroutine, effectively not yielding the code.
You can also replace
local typeTextCoroutine = coroutine.create(TypeText)
local typeTextTwoCoroutine = coroutine.create(TypeTextTwo)
coroutine.resume(typeTextCoroutine, "Example Text")
coroutine.resume(typeTextTwoCoroutine, "Example Text 2")
with
coroutine.resume(coroutine.create(TypeText), "Example Text")
coroutine.resume(coroutine.create(TypeTextTwo), "Example Text 2")