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

How can we generate a map?

How can we generate a map, part by part using wait()?

I'm actually in the scripting part of a Horror game, but I don't really know how can we generate map parts one after another like, every 5 seconds.

Thanks for answering! :D

1 answer

✓ Accepted answer

Maps should be stored in ServerStorage.

When generating a map, you should clone it.

local Map = game.ServerStorage:FindFirstChild("Map")
local ClonedMap = Map:Clone()

And since you want to move the model part by part, you want to make a new destination model.

local NewMapModel = Instance.new("Model",game.Workspace)

now, to move the parts from the Cloned Model to the NewMapModel, you should use a pairs loop.

for i,v in pairs (ClonedMap:GetChildren()) do
v.Parent = NewMapModel
wait(5)
end

Explanation of what we've just done:

ClonedMap:GetChildren() returns a table, of the descendants(Parts inside) of ClonedMap.

for i,v in pairs goes through each Instance in the table, in this case, Parts inside the model. the i is unimportant in this situation.

However, v is the part.

in Line 2, we changed v(Part inside the model) Parent to the New Model.

Then in Line 3 we waited 5 seconds before it moved on to the next part in the table.

4 comments

0

Will it work if I'll put the map in Lighting and change the destination?

0

In the script?

0

Sure I guess. ServerStorage is better. But your choice.

0

Ok thanks!

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