What i mean is like one that doesnt make you fall so then the map can change.
COMMUNITY QUESTION
How do you create an efficient map changer?
1 answer
Like I did in my game called "Prototype" (current indev) you can make a function that gets a random map from an array of maps, what I did in my code is something like this:
maps = {"Carentan", "Supercity", "Alienzone"} -- This array contains all the maps in my path
-- This is the map path, all of the map in the array needs to be located in this path!
local pathToMaps = game.ServerStorage.Maps
local mapChose = false -- This boolean returns if the map has been chose or not
function chooseRandomMap()
if mapChose then -- If the map is not chose then the function gets a random one
-- The variable gets a random map from the array
local randMap = maps[math.random(#maps)]
-- This variable instead of the previous one gets the PATH of the randMap and then clones it
local selMap = pathToMaps:FindFirstChild(randMap):Clone()
selMap.Parent = game.Workspace -- Puts the map in the game
wait(5) -- The functions wait 5 seconds before teleporting all the players
for _, player in pairs (game.Players:GetChildren()) do
-- Your teleport code
end
end
end
In your map you can put outside everything (but inside the map model) some spawn points, then get a random spawn point and teleport the player to its position ;)
This discussion is preserved as it was. New answers, comments, and votes are closed.
