I don't know how I can call it this topic

Hello I am new to script so I need help to help me I would like to make a system which makes in a folder you had Map1 and Map2 here is what I am trying to do :

sorry i am bad for speak my problem :confused:

local mapmode = script.Number.Value

wait(1)
print("Value : "..mapmode) -- mapmode = 1

wait(5)

local mapload = false

wait(1)

if mapload == false then
	mapload = true
	map = math.random()
	for i,v in pairs(game.ReplicatedStorage.map.Map..mapmode:GetChildren()) do -- error are here
		if i == map then
			local loadmap = v:clone()
			print("Map Select Are "..v.Name)
		loadmap.Parent = game.Workspace
		end
	end
end

ff

I try to do with the mapmode which is equal to 1 that in the map folder its chosen Map1 and when I but 2 in the mapmode its chosen Map2 but its telling me error

I try several ways but I can’t find how to do it: /

thank to people help me :slight_smile:

One thing I think you may be missing is the debounce variable ā€œmaploadā€. At the top, you check if it’s false, and if it is, you set it to true; but at the end of that if statement, there’s no thing that sets the value back to false.

EDIT:
Looking back at the code, you have the code:

for i,v in pairs(game.ReplicatedStorage.map.Map .. mapmode:GetChildren()) do

Basically, it’s taking the map.Map object, without the number on the end, and it’s adding a string (mapmode) to that, which can’t be done. The fix to this is

for i,v in pairs(game.ReplicatedStorage.map["Map"..mapmode]:GetChildren()) do

And I’ll explain why. It’s using "Map"..mapmode as the name of the child it’s looking for inside of game.ReplicatedStorage.map. This should solve your problem.

Can you show us the error you’re getting?

it’s normal I didn’t put the full script

fffes

I just updated my post from above, check that out.