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

Why is this round changer not working?

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

✓ Accepted answer

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

2 comments

0

Have you tested it and work?

0

No but why did you set the increment to -1 at line 14

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