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

Can someone FIX?

local choices = {"a", "b", "c", "d", "e", "f"} --Put the maps in lighting, the names of each map go there.
local map = choices[math.random(1,#choices)]
local rtarget = game.Workspace.RedTargetPosition--Name a brick "RedTargetPosition" where you want red Team to be sent to at begining.
local btarget = game.Workspace.BlueTargetPosition--Name a brick "BlueTargetPosition" where you want blue Team to be sent to at begining.
local target2 = game.Workspace.LobbyPosition --Name a brick "LobbyPosition" where you want them to be sent to at the end.
while true do
	local m = Instance.new("Message", game.Workspace)
	m.Text = "There are 10 minute rounds, a random map will be selected." --Whatever you wanted it to say
	wait(2)
	m.Text = "Once the map is selected, players are sent to it." --What do you want it to say?
	wait(2)
	m.Text = "Fight for the 10 minute round, then leave." --Change to whatever
	wait(2)
	for i = 5,1,-1 do
		wait(1)
		m.Text = "Selecting a map in" ..i --Countdown to when map is selected
	end
	map.Parent = Workspace
	map:MakeJoints()
	m.Text = map.. "has been chosen!" --Shows which map got 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,0,1) --ERROR HERE It says ')' expected near ','
		elseif v ~= nil and v.TeamColor.Name == "Bright blue" then
			v.Character.Torso.CFrame = btarget.CFrame*(0,0,1)--Spawns them next to eachother instead of inside eachother
		end
	wait(.1)
	end
print("Players teleported onto map") --Tells output they're on 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,0,1)--Keeps them from spawning inside eachother
		end
	end
end

1 comment

0

Error at line 24

1 answer

✓ Accepted answer
v.TeamColor == "Bright Red"

TeamColor does not have a name property q.q.

elseif v ~= nil and v.TeamColor == "Bright blue" then
v.Character.Torso.CFrame = rtarget.CFrame + Vector3.new(0, i * 15, 0) -- replace with line 24 and the other line you used it like line 34 and 26
+ Vector3.new(0, i * 15, 0) -- just add this to the target so it does not make them all teleport to the same place.

2 comments

0

So instead of an "elseif" statement I can just used the "if" statement?

0

no no it works im working on the error's still.

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