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

How to get a function to return more than one value?

So I'm making a script that requires the function to return two separate values. How would I be able to store those two values? I know I can store one value if I define a variable for the function, but I don't know how to do it for more than one value. Thanks Kevin.

2 comments

0

return a,b

0

How would i store the values in variables?

1 answer

✓ Accepted answer
local function twoReturnValues()
	return "Hello", "world!"
end

local return1, return2 = twoReturnValues()

print(return1) --> Hello
print(return2) --> world!

1 comment

0

Thanks

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