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

Why does the map for my game not spawn?

Thanks to the last tip the command is flowing which is good but the map is not spawning. I tried removing wait (10) to see if the wait was too long but the script still does not work.

local x = 81.6
local y = -10.1
local z = -52
local Maps = game.ServerStorage.Maps:GetChildren()
local Choose = Maps[math.random(1, #Maps)]
	-- Map selection
while Resttime do
	local placemap = Choose:Clone()
	placemap.Position = Vector3.new (x, y, z)
	placemap.Parent = game.Workspace

end

I've Now tried changing it to a funtion

	local function Placing()
	local placemap = Choose:Clone()
	placemap.Parent = game.Workspace
	placemap.Position = Maps.position
	

end

Does the same thing! Nothing!

1 comment

0

Are the maps models? Position is part of a model.. use placemap:MoveTo(Vector3.new(x,y,z))

1 answer

Is the map that is being chosen a model? If so, you're trying to feed it a position that it can't do anything with. You also have no primary part defined.

Set a primary part and use :SetPrimaryPartCFrame

placemap:SetPrimaryPartCFrame(CFrame.new (x, y, z))

Also, make sure you're not using a LocalScript and move the variable "Choose" inside of "while true do", with it being outside of it, it'll only choose a random map once, and it'll keep choosing that exact same map every time it's called.

while Resttime do
    local Choose = Maps[math.random(1, #Maps)]
    
    local placemap = Choose:Clone()
    placemap:SetPrimaryPartCFrame(CFrame.new (x, y, z))
    placemap.Parent = game.Workspace
end

1 comment

0

:SetPrimaryPart() will error if there is no primary part assigned.

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