mycode is
while true do wait(0.1) myfunction() end function myfunction() print("test") end
but error is: attempt to call a nil value
pls help
The function must be placed before the loop as it has been undefined before the loop was made. In certain cases however, the function placement no longer matters. For example, you can call a function in a function that is undefined before the function.
Will work:
function greetGuys() hiGuys() end function hiGuys() print("hiGuys") end greetGuys()
Will not work:
while true do wait(1) foo() end function foo() print("foo") end
This is because functions don't run the moment they are made like loops are since you have to call the function for it to run.
Your final script:
function myfunction() print("test") end while true do wait(0.1) myfunction() end