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

How to make a script to select a random map and put players in it?

I really don't know how to script so can someone help me? And i'd like someone to help me making a game that i've thinked. It would be a great game, or just answer the question would be appreciated too ! :)

1 comment

0

Do not spam tags on to your question. This is not allowed and will get your account suspended.

2 answers

To do this, you first put your maps in ServerStorage.

local Map1 = Game.ServerStorage.Map1
local Map2 = Game.ServerStorage.Map2

and so on and so forth. Next you would have to choose a map, with Number being the amount of maps you have.

Map = math.random(Number)
if Map == 1 then Map = Map1
elseif Map == 2 then Map = Map2

etc. Then you would get the map and put the players in it. You would put a part called targetpoint where they will be teleported.

Map:Clone(Workspace)
target = Map.targetpoint
for i, player in pairs(game.Players:GetChildren()) do
	player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end

That's it!

1 comment

0

So by simply saying "Map" with no connections or anything, it runs whatever is on the end of that =?

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