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

How do you union two parts while a game is running?

I need to make a union during the game, but i do not know how to make a union with script. I understand how to make unions when the game is not active, so do not tell me to press the union button when highlighting two parts. Remember i am trying to do this with script.

1 answer

Alright?

Try UnionAsync https://developer.roblox.com/en-us/api-reference/function/BasePart/UnionAsync

Other people would tell you to learn basic lua from youtube. next time try to send some kind of work you have done and a picture of your explorer.

here is an example, I'll try to explain it.


local unionorigin = game.workspace.FirstPart

--we're making a variable that is storing our first part, this variable is called unionorigin, variables can be called anything but can't start with a number. we're just using this as an example, instead of FirstPart you will rename this to the name of your part you want to start with.

local secondaryParts = {game.workspace.Part2, game.workspace.Part3}

--now we have a variable storing multiple values, which are 2 more parts. in your case, you would fit all of your desired part names here instead of part2 and part3. However this is only if you have your parts in Workspace, we may have to adjust this depending on where you stored your parts.

local Union1 = unionorigin:UnionAsync(secondaryParts)

--now this is a variable that is combining the first part with the rest. We can use this variable to call upon when we need it such as

Union1:Destroy() which will destroy the union.

3 comments

0

Does the amount of parts in the variable, "secondaryParts" matter?

0

never mind

0

variables can be called anything as long as it makes sense and is relevant to the code.

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