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

How to spawn a Group / Union at location of named part?

Hi guys, so this is my first post here, terribly sorry if I should be asking in a different forum.

Essentially, I have a random number generator pulling between 1-8. I'm trying to make a randomly generated map where the number corresponds to a certain type of room. (Please DON'T tell me how to do this, I'm trying to learn everything myself, and only asking here as a last resort!)

What I do want to know though, is how could I duplicate a group or union (Union is preferred, but group is fine.) and then teleport said union/group to the location of a named part. I've tried simply looking it up, but couldn't find what I was looking for.

I haven't got any code written yet, as I've no clue where to start.

Thanks in advance!

1 answer

✓ Accepted answer

You can do [insert thing u wanna clone]:Clone() to create a duplicate of it, and you can set its CFrame of that part to the CFrame of the named part. For example, someThing.CFrame = game.Workspace.namedPart.CFrame. I really like your attitude about learning, good luck!

4 comments

1

Thanks for the help! I'll try this out tommorow, but seems like it should work, I've got some experience with C++, I just don't know the Lua terminology that well. Thanks again!

0

Having some experience is always nice, happy to help!

1

Okay update, I tried it now, and when I slotted it into the randomizer, I got the error "Expected identifier when parsing expression, got '['", and the error causing [ is the one in the Clone line. Removing the [, as well as adding an extra end, adding additional identifiers, and even trying {} instead still resulted in the same error. Is this studio just being silly, or a genuine code issue?

0

I'm so sorry for not being clear, the brackets are not supposed to be there. It should be thingUWannaClone:Clone(), do not add brackets.

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