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

Why is my random map picker not synced up with the GUI that says what the map is?

Asked by 3 years ago

Hello there! I am trying to edit my round script to pick a random map to teleport everybody to, and then have the GUI that displays the Status say the map chosen. I tested it out and it says "The map chosen is Under Da Sea by MrGustavio!", and then it teleports me to the Volcano map! Can somebody tell me what I'm doing wrong?

--Variables
local IntermissionLength = 3
local RoundLength = 80

local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status

local LobbyPlatform = game.Workspace.LobbyPlatform

local GamePlatformUDS = game.Workspace.UnderDaSea.GamePlatform
local GamePlatformV = game.Workspace.Volcano.GamePlatform

local WaitVal = true

--Checking if InRound is changed
InRound.Changed:Connect(function()
    local GPTable = {GamePlatformV, GamePlatformUDS}
    local Value = math.random(1,#GPTable)

    Result = GPTable[Value]

    if Result == GamePlatformV then
        Status.Value = "The map chosen is Volcano by MrGustavio!"
        wait(3)
    end
    if Result == GamePlatformUDS then
        Status.Value = "The map chosen is Under Da Sea by MrGustavio!"
        wait(3)
    end

    print(InRound.Value)
    if InRound.Value == true then
        for _, player in pairs(game.Players:GetChildren()) do
            local char = player.Character
            char.HumanoidRootPart.CFrame = Result.CFrame
        end

    elseif InRound.Value == false then

    end
end)

--The Status changer
local function Timer()  
    while true do
        for i = IntermissionLength, 0, -1 do
            InRound.Value = false
            if Result == GamePlatformV then
                Status.Value = "The map chosen is Volcano by MrGustavio!"
                wait(1)
            end
            if Result == GamePlatformUDS then
                Status.Value = "The map chosen is Under Da Sea by MrGustavio!"
                wait(1)
            end
        end

        for i = RoundLength, 0,-1 do
            InRound.Value = true
            wait(1)
            Status.Value = "Game going on for "..i.." more seconds!"    
        end
    end
end

Timer()

Answer this question