#return
35 messages · Page 1 of 1 (latest)
it already works like that.
I turn on the game - return starts itself even if the function was not executed
yeah cause you are calling the function
and how can I fix it??
local a2 = test() will save the value the function returns
not the function
local a2 = test will save the function
oh
thank you
no worries
ofc if the function returns something
if it does not return anything it'll just run the function but the variable will be nil
oh okay thank you
** You are now Level 7! **
no worries
Although functions are very important, I recommend you don't get too ahead of yourself
yea
they are actually the last thing you would ideally learn, the problem here is that you are learning scripting for roblox instead of programming concepts
well "problem"
just a piece of advice you did not asked for
but thanks for telling me
- What is an algorithm
- What are data types and why they exist
- What are variables, and why they are used, and how they work
- printing
- how logic flows (literally how scripts are read by the interpreter)
- Prepositional logic, and if statements
- scopes
- While loop and Repeat until loop
- basic data structures (roblox language, Luau only has one, tables, but there are many!)
- for loops
- functions
if you are curious
that's the ideal order
notice how this has nothing to do with roblox
but with programming
if you know these, you can script basically anywhere, not just in roblox
hope it helps, good luck