Hello, I am wondering if a lua function requires a return? The functions I am referring to are what you would call a void function in C# or Java so a return would just be there to prevent any weird errors from happening.
For example
local function ChangeNumber()
workspace.NumberValue.Value = 5
end
I am wondering if I need to do this:
local function ChangeNumber()
workspace.NumberValue.Value = 5
return
end
I currently have not been putting returns in “void” functions but I have been getting some weird bugs in my games. I am wondering if this is the cause.
Lua automically puts a return at the end for every function so they end after completion, so you don’t need to put a return there if you’re not returning anything
If you want the function to return a certain value, then you need to use the return with the return value right after it. Otherwise, all functions will automatically terminate after they are completed.