It usually plays perfectly but lately after round five, the game just stops.
----------------------------------------[[SETTINGS]]----------------------------------------
--[[]] money1 = 50 --How many points player will get awarded on win? [[]]--
--[[]] money2 = 20 --How many points players will get awarded if serval players wins? [[]]--
--------------------------------------------------------------------------------------------
h = Instance.new("Hint")
h.Parent = game.Workspace
h.Text = ""
RegTeam = Instance.new("Team")
RegTeam.Name = "Players"
RegTeam.TeamColor = BrickColor.new("Medium stone grey")
RegTeam.Parent = game:GetService("Teams")
function round()
cc = 0
c = game.Players:GetChildren()
for num, obj in pairs(c) do
if obj:FindFirstChild("Playing") then
if obj.Playing.Value then
cc = cc + 1
end
end
end
while cc < 2 do
cc = 0
c = game.Players:GetChildren()
for num, obj in pairs(c) do
if obj:FindFirstChild("Playing") then
if obj.Playing.Value then
cc = cc + 1
end
end
end
h.Text = "Atleast 2 players needed to play."
wait(1)
end
h.Text = "New round will start in few seconds. Upgrades are under development."
wait(10)
h.Text = "Choosing random minigame..."
wait(3)
m = game.Lighting.Minigames:GetChildren()
mg = m[math.random(1,#m)]
map = mg.Map
map.Parent = game.Workspace
h.Text = ("Minigame found. It's "..mg.Name)
wait(3)
h.Text = "Teleporting players and giving tools..."
wait(3)
c = game.Players:GetChildren()
balanced = true
red = 0
blue = 0
if mg.Mode.Value == 3 then
rt = Instance.new("Team")
rt.Parent = game:GetService("Teams")
rt.AutoAssignable = false
rt.TeamColor = BrickColor.new("Bright red")
rt.Name = "Red team"
bt = Instance.new("Team")
bt.Parent = game:GetService("Teams")
bt.AutoAssignable = false
bt.TeamColor = BrickColor.new("Bright blue")
bt.Name = "Blue team"
end
for num, obj in pairs(c) do
if obj then
if obj.Playing.Value and obj.Character:FindFirstChild("Torso") then
if mg.Mode.Value == 3 then
for numm, objj in pairs(mg.Tools:GetChildren()) do
objj:clone().Parent = obj.Backpack
wait()
end
cc = map:GetChildren()
if balanced then
team = math.random(1,2)
if team == 1 then
red = red + 1
obj.TeamColor = BrickColor.new("Bright red")
elseif team == 2 then
blue = blue + 1
obj.TeamColor = BrickColor.new("Bright blue")
end
teles = {}
for nuum, obbj in pairs(cc) do
if team == 1 then
if obbj.Name == "RedTele" then
table.insert (teles, obbj)
end
elseif team == 2 then
if obbj.Name == "BlueTele" then
table.insert (teles, obbj)
end
end
wait()
end
tele = teles[math.random(1,#teles)]
x1 = tele.Position.X-(tele.Size.X/2)
x2 = tele.Position.X+(tele.Size.X/2)
z1 = tele.Position.Z-(tele.Size.Z/2)
z2 = tele.Position.Z+(tele.Size.Z/2)
obj.Character.Torso.CFrame = CFrame.new(math.random(x1,x2),tele.Position.Y+5,math.random(z1,z2))
balanced = false
else
if red < blue then
team = 1
else
team = 2
end
if team == 1 then
red = red + 1
obj.TeamColor = BrickColor.new("Bright red")
elseif team == 2 then
blue = blue + 1
obj.TeamColor = BrickColor.new("Bright blue")
end
teles = {}
for nuum, obbj in pairs(cc) do
if team == 1 then
if obbj.Name == "RedTele" then
table.insert (teles, obbj)
end
elseif team == 2 then
if obbj.Name == "BlueTele" then
table.insert (teles, obbj)
end
end
wait()
end
tele = teles[math.random(1,#teles)]
x1 = tele.Position.X-(tele.Size.X/2)
x2 = tele.Position.X+(tele.Size.X/2)
z1 = tele.Position.Z-(tele.Size.Z/2)
z2 = tele.Position.Z+(tele.Size.Z/2)
obj.Character.Torso.CFrame = CFrame.new(math.random(x1,x2),tele.Position.Y+5,math.random(z1,z2))
balanced = true
end
obj.Character.Humanoid.WalkSpeed = 0
obj.PlayerGui.Play.Alive.Value = true
wait()
else
for numm, objj in pairs(mg.Tools:GetChildren()) do
objj:clone().Parent = obj.Backpack
wait()
end
cc = map:GetChildren()
teles = {}
for nuum, obbj in pairs(cc) do
if obbj.Name == "Tele" then
table.insert (teles, obbj)
end
wait()
end
tele = teles[math.random(1,#teles)]
x1 = tele.Position.X-(tele.Size.X/2)
x2 = tele.Position.X+(tele.Size.X/2)
z1 = tele.Position.Z-(tele.Size.Z/2)
z2 = tele.Position.Z+(tele.Size.Z/2)
obj.Character.Torso.CFrame = CFrame.new(math.random(x1,x2),tele.Position.Y+5,math.random(z1,z2))
obj.Character.Humanoid.WalkSpeed = 0
obj.PlayerGui.Play.Alive.Value = true
wait()
end
end
end
end
Appreciate it.
-Your least favourite forumer. |