|
| 04 Nov 2012 10:50 PM |
When I use my tournament script, it only teleports 1 person into the tournament booth. Can you help?
local m = Instance.new("Message") m.Text = "Welcome to the Sleet Clan Tournament!" local eventrunning = false local deb = false
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name) msg = string.lower(msg)
if (msg == "watch") then speaker.Status.Value = 0 local n = Instance.new("Message") n.Parent = speaker n.Text = "Now spectating." wait(1.5) n:remove() end if (msg == "join") then speaker.Status.Value = 1 local n = Instance.new("Message") n.Parent = speaker n.Text = "Now in play queue." wait(1.5) n:remove() end
if (msg == "start") and (deb == false) then
local players = game.Players:getChildren() local competitors = 0 for i = 1, #players do if players[i].Character ~= nil then if players[i].Status.Value == 1 then competitors = competitors + 1 end end end
---We have to make this a COMPETITION. Not a "sit here, get points" place. if competitors >= 2 then
deb = true wait(1) m.Parent = game.Workspace wait(3) m.Text = "Let the duels begin!"
---First event down, now on to Fencing.-------------------------------------
local players = game.Players:getChildren() local remaining = {}
for i = 1, #players do if players[i].Character ~= nil then if players[i].Status.Value == 1 then players[i].Character.Humanoid.Jump = true wait(0.1) players[i].Character:MoveTo(game.Workspace:findFirstChild("Viewing Booth").Position + Vector3.new(math.random(-10, 10), 5, math.random(-10, 10))) local fr = Instance.new("IntValue") fr.Name = "FencingRound" fr.Value = 1 fr.Parent = players[i].Character local sword = game.Lighting.LinkedSword:clone() sword.Parent = players[i].Backpack local gun = game.Lighting.Sleetis H14:clone() gun.Parent = players[i].Backpack local ff = Instance.new("ForceField") ff.Parent = players[i].Character table.insert(remaining, players[i]) end end end
wait(2) m.Parent = nil
if #remaining >= 2 then eventrunning = true end
local round = 1 for i = 1, #remaining do print(remaining[i]) end
---------------------------------------------------------------(120 lines)------------Fencing Event Script. while eventrunning do ------------------------------------------------------------------------Begin A/B combat. if #remaining >= 2 then local a = remaining[math.random(1, #remaining)] local b = remaining[math.random(1, #remaining)] while a == b do b = remaining[math.random(1, #remaining)] wait(0.1) end
a.Character.Humanoid.Jump = true b.Character.Humanoid.Jump = true wait(6) a.Character:MoveTo(game.Workspace.SwordFightA.Position) b.Character:MoveTo(game.Workspace.SwordFightB.Position) if a.Character:findFirstChild("ForceField") ~= nil then a.Character:findFirstChild("ForceField"):remove() end if b.Character:findFirstChild("ForceField") ~= nil then b.Character:findFirstChild("ForceField"):remove() end
local c = a.Character.Humanoid.Health*b.Character.Humanoid.Health print(c)
while c ~= 0 do if a.Character ~= nil and b.Character ~= nil then c = a.Character.Humanoid.Health*b.Character.Humanoid.Health elseif (a.Character == nil or b.Character == nil) then wait(1.3) c = 0 end wait(1.3) end
if a.Character ~= nil then if a.Character.Humanoid.Health ~= 0 and a.Character:findFirstChild("FencingRound") ~= nil then a.leaderstats.Points.Value = a.leaderstats.Points.Value + a.Character.FencingRound.Value*10 a.Character.FencingRound.Value = a.Character.FencingRound.Value + 1 m.Text = "" .. a.Name .. " has won the duel!" m.Parent = game.Workspace wait(2.5) a.Character.Humanoid.Jump = true a.Character.Humanoid.Health = 100 wait(0.5) local ff = Instance.new("ForceField") ff.Parent = a.Character a.Character:MoveTo(game.Workspace:findFirstChild("Viewing Booth").Position + Vector3.new(math.random(-10, 10), 5, math.random(-10, 10))) m.Parent = nil end end if b.Character ~= nil then if b.Character.Humanoid.Health ~= 0 and b.Character:findFirstChild("FencingRound") ~= nil then b.leaderstats.Points.Value = b.leaderstats.Points.Value + b.Character.FencingRound.Value*10 b.Character.FencingRound.Value = b.Character.FencingRound.Value + 1 m.Text = "" .. b.Name .. " has won the duel!" m.Parent = game.Workspace wait(2.5) b.Character.Humanoid.Jump = true b.Character.Humanoid.Health = 100 wait(0.5) local ff = Instance.new("ForceField") ff.Parent = b.Character b.Character:MoveTo(game.Workspace:findFirstChild("Viewing Booth").Position + Vector3.new(math.random(-10, 10), 5, math.random(-10, 10))) m.Parent = nil end end
end -------------------------------------------------------------------------End A/B combat print("Checking Fencing...") wait(3.1) --To make sure we get "FencingRound" out of the dead player... eventrunning = false remaining = {} for i = 1, #players do if players[i].Character ~= nil then if players[i].Character:findFirstChild("FencingRound") ~= nil then if players[i].Character.FencingRound.Value == round then table.insert(remaining, players[i]) end end end end ----------To check remaining players. if #remaining >= 2 then print("2+ players remain.") eventrunning = true
elseif #remaining == 1 then print("1 player remains...checking for others.")
for i = 1, #players do if players[i].Character ~= nil then if players[i].Character:findFirstChild("FencingRound") ~= nil then if players[i].Character.FencingRound.Value == round + 1 then remaining[1].Character.FencingRound.Value = round + 1 round = remaining[1].Character.FencingRound.Value table.insert(remaining, players[i]) eventrunning = true end end end end
if eventrunning == false then m.Text = "" .. remaining[1].Name .. " has won the Sleet Clan Tournament!" m.Parent = game.Workspace remaining[1].leaderstats.Points.Value = remaining[1].leaderstats.Points.Value + 150 remaining[1].Character:BreakJoints() wait(3) m.Parent = nil end
elseif #remaining == 0 then print("Must not be any players left at this level...checking next round") for i = 1, #players do if players[i].Character ~= nil then if players[i].Character:findFirstChild("FencingRound") ~= nil then if players[i].Character.FencingRound.Value == round + 1 then table.insert(remaining, players[i]) eventrunning = true end end end end
if eventrunning == true then round = round + 1 end
end----------End remaining check. ---Tournament runs until we have a definitive winner.
end -------------------------------------------------------------------------------End Fencing Tournament Script.
m.Text = "Congratulations to all who have participated!" m.Parent = game.Workspace wait(3) m.Parent = nil
--------------------------------------------------------------------------------------------------------End of script.
deb = false m.Text = "Welcome to the Sleet Clan Tournament!" end end end
function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end
game.Players.ChildAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 05 Nov 2012 04:21 AM |
| This is not a place where we fix or help you with scripts. Post this on scripting helpers. |
|
|
| Report Abuse |
|