Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Passing values through functions?

Is it possible?

I have a script where I call InputBegan and InputEnded and I was wondering if I could pass a value through both of those?

3 comments

0

You mean variables?

0

Yes

0

So how would I do that?

1 answer

Slightly confusing question so I assumed that you want to have a function act like a argument to a parameter

You can have a function act like an argument/passing a value if it returns.

For example:

local function test()
	return 10
end

print(test()) -- prints 10, since the function returned 10

If you want to pass an argument to both InputBegan and InputEnded, you can only really

local parameter = "test"

InputBegan(parameter)
InputEnded(parameter)

This discussion is preserved as it was. New answers, comments, and votes are closed.