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
COMMUNITY QUESTION
Can't functions be given a value? Like in this script?(it is not working xD)
2 answers
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.
1 comment
0
Thanks
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
1 comment
0
So you can make Adder return 10 at the bottom of the function if you want to make the function return the value of 10
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Don't swear here..
Sorry, I will edit it out, but can u answer the question?