Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Galicate 106
6 years ago

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 :(

0
Check the AlvinBloxx tutorial for a random map selector and round system - https://www.youtube.com/watch?v=z9EgTqThDmU&t=173s Never2Humble 90 — 6y
0
The only problem with this is that it only covers one map and doesnt show you how to make it random Galicate 106 — 6y
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. xEiffel 280 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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

Ad

Answer this question