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

Why is this round changer not working?

Asked by 10 years ago
local choices = {"a", "b", "c", "d", "e", "f"}
local map = choices[math.random(1,#choices)]
local rtarget = game.Workspace.RedTargetPosition
local btarget = game.Workspace.BlueTargetPosition
local target2 = game.Workspace.LobbyPosition 

while true do
    local m = Instance.new("Message", game.Workspace)
    m.Text = "There are 10 minute rounds, a random map will be selected."
    wait(1)
    m.Text = "Once the map is selected, players are sent to it."
    wait(1)
    m.Text = "Fight for the 10 minute round, then leave."
    wait(1)
    for i = 5,1,-1 do
        wait(1)
        m.Text = "Selecting a map in" ..i
    end
    map.Parent = Workspace
    map:MakeJoints()
    m.Text = map.. "has been chosen!"
    wait(3)
    for i,v in pairs (game.Players:GetPlayers()) do
        if v ~= nil and v.TeamColor.Name == "Bright red" then
            v.Character.Torso.CFrame = rtarget.CFrame*(0) 
        elseif v ~= nil and v.TeamColor.Name == "Bright blue" then
            v.Character.Torso.CFrame = btarget.CFrame*(0)
        end
    wait(.1)
    end
print("Players teleported onto map")
wait(600) --10 minutes
    for i,z in pairs (game.Players:GetPlayers()) do
        if z ~= nil then
            z.Character.Torso.CFrame = target2.CFrame*(0)
        end
    end
end

1 answer

Log in to vote
0
Answered by 10 years ago

Heres the code I fixed

local choices = {"a", "b", "c", "d", "e", "f"}
local map = choices[math.random(1,#choices)]
local rtarget = game.Workspace.RedTargetPosition
local btarget = game.Workspace.BlueTargetPosition
local target2 = game.Workspace.LobbyPosition
while true do
    local m = Instance.new("Message", game.Workspace)
    m.Text = "There are 10 minute rounds, a random map will be selected."
    wait(1)
    m.Text = "Once the map is selected, players are sent to it."
    wait(1)
    m.Text = "Fight for the 10 minute round, then leave."
    wait(1)
    for i = 5,1,1 do
        wait(1)
        m.Text = "Selecting a map in" ..i
    end
    map.Parent = Workspace
    map:MakeJoints()
    m.Text = map.. "has been chosen!"
    wait(3)
    for i,v in ipairs (game.Players:GetPlayers()) do
        if v ~= nil and v.TeamColor.Name == "Bright red" then
            v.Character.Torso.CFrame = rtarget.CFrame*(0)
        elseif v ~= nil and v.TeamColor.Name == "Bright blue" then
            v.Character.Torso.CFrame = btarget.CFrame*(0)
        end
    wait(.1)
    end
print("Players teleported onto map")
wait(600) --10 minutes
    for i,z in ipairs (game.Players:GetPlayers()) do
        if z ~= nil then
            z.Character.Torso.CFrame = target2.CFrame*(0)
        end
    end
end
0
Have you tested it and work? NinjoOnline 1146 — 10y
0
No but why did you set the increment to -1 at line 14 RobloxMinecraftDK 0 — 10y
Ad

Answer this question