function Funct1() print("This is the first function") end function Funct2() print("This is the second function") end Adder() = 10 -- Why can't I give the function a number value like this? function Adder() Funct1() wait(2) Funct2() wait(2) print("Holy moly this stuff gets confusing FAST") end repeat Adder() until Adder() == 11
The value never changes as the function never changes it. Not to mention the value is the same as the function after it.
function Funct1() print("This is the first function") end function Funct2() print("This is the second function") end Value = 10 --Value has to have a different name then the function. Adder() only fires the function, and since its before the function is named it wont work. function Adder() Funct1() wait(2) Funct2() wait(2) print("Holy #### this #### gets confusing FAST") --No swearing :-) Value = Value + 1 -- Changes the value end repeat Adder() until Value == 11
Cant say I solved your problem but I tried what I could.
Functions can return a value which then you can assign that value to a variable.
For example:
local function getNumber(x) if type(x) == "number" then return x end return 0 end -- set a variable to a number returned by -- the function local num = getNumber(54) -- num now will equal 54 because the function -- returns a number type value which we passed 54