do anyone know how to make cloning inorder or Consecutively like
when the map is already use it will not going to use again
my problem is when the map is use it will going to use again in another round if u dont get it
ill make it simple
there is a round system and it will pick a map so banana has pick and after the round the banana got pick again
i want like only once the map pick and the other map will pick
script
local maps = game.ReplicatedStorage.Maps:GetChildren()
local rand = math.random(1,#maps)
local map = maps[rand]:Clone()
map.Parent = game.Workspace.Map
local maxmaps=#maps
local map=0
if map+1>maxmaps then map=1 else map+=1 end
local selectedmap=maps[map]
this should cycle though the maps table and select a new map every round and after it reaches the last map on the table it resets to the first map and cycles again!
local storage = game:GetService("ReplicatedStorage")
local maps = storage:WaitForChild("Maps"):GetChildren()
local rand = math.random(1, #maps)
local map = maps[rand]:Clone()
map.Parent = game.Workspace:WaitForChild("Map")
if you still need help with this you could have a function with that inside
local mapnumber=0
function PickMap()
if mapnumber+1>#maps then mapnumber=1 else mapnumber+=1 end
local selectedmap=maps[mapnumber]
return selectedmap
end
local map=PickMap()
local clonedmap=map:Clone()
clonedmap.Parent=workspace
local maxmaps = #maps
local map = 0
if map + 1 > maxmaps then
map = 1
else
map += 1 end
local selectedmap = maps[map]:Clone()
selectedmap.Parent = game.Workspace.Map
local storage = game:GetService("ReplicatedStorage")
local maps = storage:WaitForChild("Maps"):GetChildren()
local round = 0
--round started
if round >= #maps then
round = 0
end
round += 1
local roundMap = maps[round]
local usedMaps = {}
local maps = game.ReplicatedStorage.Maps:GetChildren()
local rand = math.random(1,#maps)
local map = maps[rand]:Clone()
if not table.find(usedMaps,map) then
table.insert(usedMaps,map)
map.Parent = game.Workspace.Map
else
while wait() do
local rand = math.random(1,#maps)
local map = maps[rand]:Clone()
if not table.find(usedMaps,map) then
table.insert(usedMaps,map)
map.Parent = game.Workspace.Map
break
end
end
end