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

Map decisive picking?

Asked by
Irvene 5
9 years ago

How can you choose which map you want to spawn? I'd like some help on that sort of advanced tech.

1 answer

Log in to vote
0
Answered by 9 years ago

You just have some maps in a Model or Instance in Replicated Storage. I guess I can give you a head start on this. I have included some wiki articles in the bottom of this answer that might help.

EDIT: I noticed you wanted to pick a map that you wanted. This is simple as doing the example below.

Don't forget to make sure everything exist!

local Map = game.ReplicatedStorage:FindFirstChild("MAPNAME")

function InsertMap()
local map = Map:Clone()
map.Parent = game.Workspace
end

or you can do a random map as so:

local Maps = game.ReplicatedStorage.Maps:GetChildren() --Make sure you know what this means!

function RandomMap(maps)
local ChosenMap = maps[math.random(1, #maps)]:Clone()
ChosenMap.Parent = game.Workspace
end

RandomMap(Maps)

http://wiki.roblox.com/index.php?title=API:Class/Instance/GetChildren http://wiki.roblox.com/index.php?title=Table http://wiki.roblox.com/index.php?title=Random_numbers

Don't forget to mark this as solved and as the correct answer!

0
:GetChildren() I assume this selects the children of a specific model/script..etc? Irvene 5 — 9y
0
Correct. YasuYoshida 171 — 9y
Ad

Answer this question