function boom(p) local check = nil local list = game.Workspace:GetChildren() for i=1,#list do if list[i].ClassName == p then return list[i] and list[i].Name end end end while wait() do local target = boom('Part') if target then print(target) target():remove() end end
basically i am trying to get it to remove 1 part and print the second return if i could get help dat would be cool
This is easily done by using a comma between the values for the return command:
local function Return2Vars(x, y) return x, y end print(Return2Vars("Hello", "World!")) -- Output: -- Hello World!
But how can we collect these values and store them in variables? Well, this is also quite easily done by assigning two variables on the same line to that of the function call:
local function Return2Vars(x, y) return x, y end local x, y = Return2Vars("It", "Works!") print(x, y) -- Output: -- It Works!
For clarification, this works for any number of variables and is not just limited to two. For example, you could write return 1, 2, 3, "Four"
and the integers 1, 2, 3 and the string Four would be returned.