Map is not replicating to Workspace properly

Basically what I want to do is make random maps from the folder “Maps” duplicate into the Workspace and be placed at the loader’s specific position.

Here is the part of the script I am having trouble with:
image
Here is the error I keep getting in the output:
image
For some reason, it’s unable to replicate the map from RS. Any help would be appreciated. Thanks!

1 Like

Can you send the explorer? It also may be because you are running that script before the game is loaded.

1 Like

try adding this to the top of your script

local Maps = game:GetService("ReplicatedStorage"):WaitForChild("Maps")
1 Like

This means map ‘Randomizer’ is not found in “ReplicatedStorage.Maps”.
Also, Clone code is not properly used. check example code: Instance | Documentation - Roblox Creator Hub

local Maps = game:GetService("ReplicatedStorage"):WaitForChild("Maps")
local loaderCount = 0
for i = 1, 9, 1 do
    loaderCount = loaderCount + 1
    local movetopos = workspace["Loader" .. loaderCount].Position
    print(movetopos)
    for i = 1, #maps do
        local chosenmap = maps[math.random(1,#maps)]
        local mapclone = chosenmap:Clone()
    end
    mapclone.Parent = workspace
    mapclone:MoveTo(movetopos)
end

Try using this code. If it doesn’t work tell me the error

Will do, give me a second! :heart:

Just curious, why are you loading 9 random maps and why are you using

for i = 1, #maps do
   local chosenmap = maps[math.random(1,#maps)]
   local mapclone = chosenmap:Clone()
end

when you could use

local chosenmap = maps[math.random(1,#maps)]
local mapclone = chosenmap:Clone()

Hello there. I tried your code out and it seems to be working just fine. However, it does not seem to place the maps accordingly:
image

do you have something called Loader3 in the workspace?

Yes, I have 9 loader parts for 9 random maps I want to load. Edit: The map uses 9 loaders but the script seems to break at 3.

Ok, maybe try :WaitForChild when loading the map

1 Like

is there anything that tampers with these loaders? maybe parents them or deletes them?

could you show a pic of your explorer?

Hey again. The map duplicated normally:
image
However, it’s stacked multiple times and it is not placed on the loaders accordingly.
Here is the current script as it is right now:

image

Use cframes. Make a part and place it in the center of your map and make it the primary part. Then, use :SetPrimaryPartCFrame(movetopos) and make movetopos a CFrame

local Maps = game:GetService("ReplicatedStorage"):WaitForChild("Maps")
local loaderCount = 0
for i = 1, 9, 1 do
    loaderCount = loaderCount + 1
    local movetopos = workspace["Loader" .. loaderCount].CFrame
    print(movetopos)
    for i = 1, #maps do
        local chosenmap = maps[math.random(1,#maps)]
        local mapclone = chosenmap:Clone()
    end
    mapclone.Parent = workspace
    mapclone:SetPrimaryPartCFrame(movetopos)
end
1 Like

Thank you so much for sticking that far! :heart:

1 Like

No problem, i am happy to help anyone :slight_smile:

1 Like