i’ve seen other threads but i haven’t quite been able to understand the fix to my problem. here is what i want to accomplish:
because i do not want the code from my script to be seen/taken, i will provide an example.
local module = {}
function module.test(player)
local character = player.Character
print(character.Name)
end
function module.test2(player)
local character = player.Character
wait(3)
print(character.Name)
end
return module
assume that the above is the module.
local testmod = script.parent.testmod
require(testmod).test2(player)
require(testmod).test(player)
the code above is a snippet of how it would be called.
i would need these two functions to work simultaneously. so, it would print the characters name immediately on activation, and then 3 seconds later. not wait 3 seconds, then print it twice in a row.
i’ve tried coroutine, but i haven’t been able to use it correctly. somebody please correct/give a correct example how the code is being called, so they would function as desired. thank you for your time.
Honestly, I recommend task.spawn over coroutine if you just want to spawn in an instant-thread. If you want to have controls over it, I’d recommend going for coroutines.