Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Load and End maps? [closed]

Asked by 8 years ago

I need a script to load and end maps, can anyone make one for me?

0
not a request site, advertise yourself on forums TheDeadlyPanther 2460 — 8y
0
Your question is so vague that I don't even know where to start Im_Kritz 334 — 8y

Closed as Not Constructive by M39a9am3R and ImageLabel

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
obcdino 113
8 years ago

You commenters are soooooooooooooooooooooo mean :((((((((

Anyways...

First, assuming you want to clone everything in workspace, that is exactly what we'll do.

The clone function allows you to clone an existing instance, although it has no default parent.

So how exactly do we clone everything in workspace?

Simply get the children of workspace using GetChildren in a for loop.

For example, this script will print all the names of the objects in workspace:

for i,v in pairs(game.Workspace:GetChildren())do -- Grabs all the children inside workspace
print(v.Name) -- Prints the name. As you can see we used 'v' as it's already stated.
end

Now, if you want to CLONE everything in workspace, it's similar. The only problem is that you have to REMEMBER THAT IT HAS NO DEFAULT PARENT. That can be easily fixed by just parenting it in the code.

To clone everything in workspace, just do this:

for i,v in pairs(game.Workspace:GetChildren())do
cloneditem = v:Clone()
cloneditem.Parent = game.Workspace
end

PLEASE UPVOTE AND ACCEPT MY ANSWER! THANKS!

Ad