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

My random map script isnt working and I dont know why???

MY script is

playarea = math.randomseed(1,3)
min = 0
sec = 5

while true do
	wait(0.1)
	if script.Parent.Parent.GameMode.Loaded.Value == true then
			script.Parent.Text = (min..":"..sec)
			wait(1)
			sec = sec - 1
			if sec == 0 then
				min = min - 1
				sec = 59
			end
	end
	end

while true do
	wait(0.1)
	if min == 0 and sec == 0 then
		game.Workspace("Map" ..playarea):Destroy()
		playarea = math.randomseed(1,3)
		wait(60)
		game.Lighting("Map" ..playarea):Clone().Parent = game.Workspace
	end
end
	


I dont know why its not working also roblox forums shutdown forever :(

3 comments

0

Check the AlvinBloxx tutorial for a random map selector and round system - https://www.youtube.com/watch?v=z9EgTqThDmU&t=173s

0

The only problem with this is that it only covers one map and doesnt show you how to make it random

0

I don't know If this is correct, but you're calling another loop right after another loop. The loops don't go separately from what I remember. The first loop will continue without worrying about the 2nd loop. My suggestion is to put it into one loop.

1 answer

math.randomseed() isn't the same as math.random(). Randomseed sets the seed that Random uses. Therefore, you just change the script to:

local playarea = math.random(1,3)
local min = 0
local sec = 5

while true do
    wait(0.1)
    if script.Parent.Parent.GameMode.Loaded.Value == true then
            script.Parent.Text = (min..":"..sec)
            wait(1)
            sec = sec - 1
            if sec == 0 then
                min = min - 1
                sec = 59
            end
    end
    if min == 0 and sec == 0 then
        game.Workspace("Map" ..playarea):Destroy()
        playarea = math.random(1,3)
        wait(60)
        game.Lighting("Map" ..playarea):Clone().Parent = game.Workspace
    end
end

I did as some comments suggested, too.

One thing, however. I suggest you use game.ServerStorage over game.Lighting. ServerStorage is actually made for what you are using.

Thanks,

Explosion

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