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

Tournament script error? | HELP |

function ChooseDuelers()
	repeat wait() until game.Players.NumPlayers >=2
	for i = 20, 0, -1 do
		script.Lobby:Play()
		h = Instance.new("Hint",workspace)
		h.Text = "Round starting in: " ..i
		wait(1)
		h:Destroy()
	end
	local Players=Game.Players:GetPlayers() 
	local Chosen1, Chosen2 = math.random(1, #Players), 0
	repeat Chosen2 = math.random(1, #Players) until Chosen2 ~= Chosen1
	m = Instance.new("Message",workspace)
	m.Text = Players[Chosen1].Name.. " and " ..Players[Chosen2].Name.. " have been chosen!"
	wait(3)
	Players[Chosen1].Character:MoveTo(Vector3.new(-82.5, 0.59, 19))
	Players[Chosen2].Character:MoveTo(Vector3.new(-82.5, 0.59, -25))
	m.Text = "Duelers teleported, starting round."
	wait(3)
	m:Destroy()
	local chosen1 = game.Lighting.Chosen1:clone()
	chosen1.Parent = Players[Chosen1].Backpack
	local chosen2 = game.Lighting.Chosen2:clone()
	chosen2.Parent = Players[Chosen2].Backpack
	Players[Chosen1].Character.Humanoid.WalkSpeed = 0
	Players[Chosen2].Character.Humanoid.WalkSpeed = 0
	for i = 3, 0, -1 do
		m.Text = "Round starting in: " ..i
		wait(1)
	end
	for i = 30, 0, -1 do
		script.Lobby:Stop()
		script.Battle:Play()
		Players[Chosen1].Character.Humanoid.WalkSpeed = 16
	    Players[Chosen2].Character.Humanoid.WalkSpeed = 16
		h = Instance.new("Hint",workspace)
		h.Text = "New round in: " ..i
		wait(1)
		if Players[Chosen1].Character.Humanoid.Health == 0 then
			h:Destroy()
			m = Instance.new("Message",workspace)
			m.Text = Players[Chosen2].Name.." won!"
			wait(3)
			m:Destroy()
			Players[Chosen2].Character:MoveTo(Vector3.new(-59.5, 1.79, -3))
			script.Battle:Stop()
		end
		if Players[Chosen2].Character.Humanoid.Health == 0 then
			h:Destroy()
			m = Instance.new("Message",workspace)
			m.Text = Players[Chosen1].Name.." won!"
			wait(3)
			m:Destroy()
			Players[Chosen1].Character:MoveTo(Vector3.new(-59.5, 1.79, -3))
			script.Battle:Stop()
		end
	end
end

ChooseDuelers()

Whenever it teleports the players, it just shows the intermission again. Any help?

1 answer

✓ Accepted answer

Well, first thing, there is no variable for 'I'. But what is the 'for i = 20,0,-1'? I don't understand that part, sorry. Shouldn't it be 'for i = 0,20'? This, for me, is very complicated because I'm only a novice. Also, you should have a few bricks with CanCollide false and Transparency 1 that you use for teleporting instead of certain positions, like this:

Players[Chosen1].Character:MoveTo(Vector3.new(game.Workspace.Map1.TPBrick1.Position))

It could be stopping the battle function/music/whatever it is but not stopping the lobby one. This is a complicated one.

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