How to pass back with functions?

is there a way to allow a function to “pass back” something in it? this is what I was imagining:

Function GetRandNum()
local Rand = math.random(1, 100)
end

local Timer = GetRandNum()

this is just a very basic version, Im basically looking for a way to make a “module function”. Thanks in advance!

Do you mean using return? I don’t really understand what do you mean with “pass back”.

yeah, just when I add return Rand at the end of the function and I call it it either does nothing/prints a random sting tied to the function, how do you use return in functions?

function GetRandNum()
   local Rand = math.random(1, 100)
   return Rand
end

local Timer = GetRandNum()

You made it like this? It works fine for me, it’s a very simple function. And by the way, you can avoid using a variable if you prefer

function GetRandNum()
   return math.random(1, 100)
end

But it’s completely your choice.

thanks, sorry for the trouble. I was trying to say print(GetRandNum) as a test, it was returning the name of the function. once again thank you for putting up with my noobie programming skills, I will mark as solution!

No problem, glad I helped you!