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

I can't figure out why the second map never prints out?

there is a delay between the 1st map spawning but nothing is printing? heres the short code

while true do
	currentmap = math.random(2)
	if currentmap == 1 then
		print("Map 1 Selected")
			game.Lighting.WreckedMap.Parent = game.Workspace
		wait(5)
		game.Workspace.WreckedMap.Parent = game.Lighting
	if currentmap == 2 then 
		print("Map 2 Selected")
		wait(5)
		end
	end
end

1 answer

✓ Accepted answer

This is not good code by any means, though I fixed your problem.

Your code is saying (in plain English) if the map is 1 and the map is 2, do stuff.

This is impossible, as the variable map cannot be two things at the same time. What you meant to say is if the map is 1, do stuff. If the map is 2, do other stuff

also, math.random needs two arguments.

while true do
    currentmap = math.random(1,2)
    if currentmap == 1 then
        print("Map 1 Selected")
            game.Lighting.WreckedMap.Parent = game.Workspace
        wait(5)
        game.Workspace.WreckedMap.Parent = game.Lighting
    elseif currentmap == 2 then 
        print("Map 2 Selected")
        wait(5)
        end
    end
end

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