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

How to clone multiple things with a private module?

So, here is the current code to clone ONE object with the private module:

local module = {}
password = 12345
function module.ReturnTheThing(argument)
if argument == password then
return script.Script:Clone()
end
end

return module

I then tried to clone another thing by this:

local module = {}
password = 12345
function module.ReturnTheThing(argument)
if argument == password then
return script.Script:Clone()
return script.Part:Clone()
end
end

return module

It didn't work

1 answer

✓ Accepted answer

You cannot do multiple returns. HOWEVER, return can return multiple objects.

return script.Parent:Clone(), script.Part:Clone()

local Parent, Part = require(module).ReturnTheThing(12345)

-->> **script.Script:Clone()** is the first arg, **script.Part:Clone()** is the second arg returned.

1 comment

0

Note that this isnt actually a fully functioning script.. The first line is supposed to be part of the module script

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