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

How do you return and use more than 1 thing?

function GetStrings()
	local String1 = "Hi my name is"
	local String2 = "iLordOfAviation"
	
	return String1, String2
end

local Strings = GetStrings()
print(Strings[1], Strings[2])

I expected this to print "Hi my name is iLordOfAviation" but it didn't... How do you do this?

2 answers

✓ Accepted answer
function GetStrings()
    local String1 = "Hi my name is"
    local String2 = "iLordOfAviation"

    return String1, String2
end

local String1, String2 = GetStrings()
print(String1, String2)

Simple, isn't it? :)

1 comment

0

thanks

Try this

local GetStrings = {
    String1 = "Hi my name is",
    String2 = "iLordOfAviation"
}
local Strings = GetStrings

print(Strings.String1)
print(Strings.String2)

2 comments

0

whoops wrong code xd

0

Maybe try Kiriot22's code..

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