johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 07:09 PM |
If Npl.Value >= 4 then wont work even if Npl.Value is 4 in output i just get " starting starting starting starting starting "
:(
local Tp = game.Workspace.Docks.Floor local Dockss = game.Workspace.Docks:GetChildren() local DC = game.Workspace.Doors:GetChildren() local Walls = game.Workspace.Walls:GetChildren() while true do wait(1) local Npl = script.PlayerNum if Npl.Value >= 1 then print("starting") if Npl.Value == 5 or Npl.Value == 7 or Npl.Value == 9 or Npl.Value == 11 then print("gamewait") plrs = game.Players:GetPlayers() for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = true plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for even number of players." plrs[i].PlayerGui.Wait.Frame.TextBox1.FontSize = "Size14" plrs[i].PlayerGui.Wait.Frame.TextBox.FontSize = "Size10" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Must start with even number of players" wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for even number of players.." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for even number of players..." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = false wait(.1) end elseif Npl.Value <= 3 then print("gamewait") plrs = game.Players:GetPlayers() for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = true plrs[i].PlayerGui.Wait.Frame.TextBox1.FontSize = "Size24" plrs[i].PlayerGui.Wait.Frame.TextBox.FontSize = "Size14" plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for 4 players." plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Get some friends to play with you" wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for 4 players.." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for 4 players..." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = false wait(.1) end elseif Npl.Value >= 4 then if script.Cloned == false then local AllBoats = game.Workspace.Boats local AllClones = AllBoats:clone() AllBoats:remove() print("gamestart") AllBoats:remove() AllBoats1 = AllClones:clone() AllBoats.Parent = game.Workspace AllBoats:makeJoints() AllBoats1.Parent = game.Workspace.Boats AllBoats1:makeJoints() wait(.1) for i = 1, #Dockss do Dockss[i].Transparency = 0 Dockss[i].CanCollide = true wait(.1) end for i = 1, #DC do DC[i].Head.Transparency = 0 DC[i].Head.CanCollide = true DC[i].NameScript.Disabled = false wait(.1) end for i = 1, #DC do DC[i].Name = "0" end for i = 1, #Walls do Walls[i].CanCollide = true end print("Docks Generated") for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = true plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Starting Game." plrs[i].PlayerGui.Wait.Frame.TextBox1.FontSize = "Size24" plrs[i].PlayerGui.Wait.Frame.TextBox.FontSize = "Size14" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Please wait a moment" wait(.1) end game.StarterGui.Wait.Frame.Visible = true game.StarterGui.Wait.Frame.TextBox1.Text = "Starting Game." game.StarterGui.Wait.Frame.TextBox1.FontSize = "Size24" game.StarterGui.Wait.Frame.TextBox.FontSize = "Size14" game.StarterGui.Wait.Frame.TextBox.Text = "Please wait a moment" wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Starting Game.." wait(.1) end game.StarterGui.Wait.Frame.TextBox1.Text = "Starting Game.." wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Starting Game..." wait(.1) end game.StarterGui.Wait.Frame.TextBox1.Text = "Starting Game..." wait(2) for i = 1, #plrs do plrs[i].Character:MoveTo(Tp.Position) if plrs[i]:findFirstChild("leaderstats") ~= nil then plrs[i].leaderstats.Cash.Value = plrs[i].leaderstats.StartCash.Value end wait(.1) end print("Wait") for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "1 Minute to decide teams" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Docks will soon be deleted" wait(.1) end game.StarterGui.Wait.Frame.TextBox.Text = "Docks will soon be deleted" game.StarterGui.Wait.Frame.TextBox1.Text = "1 Minute to decide teams" print("Waiting for teams to be decided") DC = game.Workspace.Doors:GetChildren() wait(60) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Teams Decided" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Docks are being deleted" wait(.1) end game.StarterGui.Wait.Frame.TextBox1.Text = "Teams Decided" game.StarterGui.Wait.Frame.TextBox.Text = "Docks are being deleted" print("Teams Decided") wait(5) for i = 1, #Dockss do Dockss[i].Transparency = 1 Dockss[i].CanCollide = false wait(.1) end for i = 1, #DC do DC[i].Head.Transparency = 1 DC[i].Head.CanCollide = false DC[i].NameScript.Disabled = true wait(.1) DC[i].Name = " " DC[i].PlayerAmount.Value = 0 end for i = 1, #Walls do Walls[i].CanCollide = true end for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = false end game.StarterGui.Wait.Frame.Visible = false print("Docks Removed") wait(60) AllBoats:remove() for i = 1, #plrs do if plrs[i]:findFirstChild("leaderstats") ~= nil then plrs[i].leaderstats.Cash.Value = 0 end wait(.1) end end end end end
|
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
| |
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 07:15 PM |
Nevermind, it seems that if Npl's vaalue is over 4 the if then statement will only work once |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
| |
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
| |
|
rayoma
|
  |
| Joined: 13 Nov 2009 |
| Total Posts: 1911 |
|
|
| 08 Jul 2012 07:48 PM |
| Remember that with elseif that means that the first conditions can't be true, so if the number is 3 then it will first check `if Npl.Value >= 1 then` which is true, so then it will not go on to the next condition. |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 08:01 PM |
but all of the other condition are inside of if Npl.Value >= 1 then so that one would activate those other conditions and since none of them were activated it mean that Npl.Value wasnt over 4 which it was... |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 08:03 PM |
| I feel like somewhere it is changing a value and that the script feels like the value is already changed to what it wants so it doesnt do anything.... |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 08:05 PM |
because if it is over 4 it picks none of the conditions inseide of if Npl.Value >= 1 but if i lower it to 3 it picks the condition if Npl <= 3 but if it goes back up to 4 it doesnt pick the condition if Npl.Value >= 4 then |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 08:55 PM |
please help :c
LMaD(quit) - 600 posts SH - 200 |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2012 09:02 PM |
ELSEif
If You want them both to Fire, use another if/then function, not a elseif
|
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 09:22 PM |
...but i thought that the order was always like this :o if elseif elseif
LMaD(quit) - 600 posts SH - 200 |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 09:40 PM |
plz tell
LMaD(quit) - 600 posts SH - 200 |
|
|
| Report Abuse |
|
|
rayoma
|
  |
| Joined: 13 Nov 2009 |
| Total Posts: 1911 |
|
|
| 08 Jul 2012 10:07 PM |
| Sorry I didn't see how you had it layed out before ( too much code, skimmed through it :P ). Add prints everywhere you can to see where the code ends. |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 10:11 PM |
The code doesnt error out or end at all just once it completes elseif Npl.Value >= 4 once it complete that whole part the script keeps running but is never able to run that if then statment again even though Npl.Value is over 4 and not an odd number
LMaD(quit) - 600 posts SH - 200 |
|
|
| Report Abuse |
|
|
rayoma
|
  |
| Joined: 13 Nov 2009 |
| Total Posts: 1911 |
|
|
| 08 Jul 2012 10:42 PM |
> if script.Cloned == false then
|
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 10:44 PM |
there is some errors that i fixed lately and everything in that if then statement works perfectly buti still have same problem
Updated script:
local Tp = game.Workspace.Docks.Floor local Dockss = game.Workspace.Docks:GetChildren() local DC = game.Workspace.Doors:GetChildren() local Walls = game.Workspace.Walls:GetChildren() while true do wait(1) local Npl = script.PlayerNum if Npl.Value >= 1 then Npl = script.PlayerNum print("starting") if Npl.Value == 5 or Npl.Value == 7 or Npl.Value == 9 or Npl.Value == 11 then print("gamewait") plrs = game.Players:GetPlayers() for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = true plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for even number of players." plrs[i].PlayerGui.Wait.Frame.TextBox1.FontSize = "Size14" plrs[i].PlayerGui.Wait.Frame.TextBox.FontSize = "Size10" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Must start with even number of players" wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for even number of players.." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for even number of players..." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = false wait(.1) end elseif Npl.Value <= 3 then print("gamewait") plrs = game.Players:GetPlayers() for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = true plrs[i].PlayerGui.Wait.Frame.TextBox1.FontSize = "Size24" plrs[i].PlayerGui.Wait.Frame.TextBox.FontSize = "Size14" plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for 4 players." plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Get some friends to play with you" wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for 4 players.." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Waiting for 4 players..." wait(.1) end wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = false wait(.1) end elseif Npl.Value >= 4 then if script.Cloned.Value == false then local AllBoats = game.Workspace.Boats local AllClones = AllBoats:clone() script.Cloned.Value = true print("Clones Saved") print("gamestart") AllBoats1 = AllClones:clone() AllBoats.Parent = game.Workspace AllBoats:makeJoints() wait(.1) for i = 1, #Dockss do Dockss[i].Transparency = 0 Dockss[i].CanCollide = true wait(.1) end for i = 1, #DC do DC[i].Head.Transparency = 0 DC[i].Head.CanCollide = true DC[i].Door.CanCollide = true DC[i].Door1.CanCollide = true DC[i].TpTo.CanCollide = true DC[i].TpTo1.CanCollide = true DC[i].NameScript.Disabled = false wait(.1) end for i = 1, #DC do DC[i].Name = "0" end for i = 1, #Walls do Walls[i].CanCollide = true end print("Docks Generated") for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = true plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Starting Game." plrs[i].PlayerGui.Wait.Frame.TextBox1.FontSize = "Size24" plrs[i].PlayerGui.Wait.Frame.TextBox.FontSize = "Size14" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Please wait a moment" wait(.1) end game.StarterGui.Wait.Frame.Visible = true game.StarterGui.Wait.Frame.TextBox1.Text = "Starting Game." game.StarterGui.Wait.Frame.TextBox1.FontSize = "Size24" game.StarterGui.Wait.Frame.TextBox.FontSize = "Size14" game.StarterGui.Wait.Frame.TextBox.Text = "Please wait a moment" wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Starting Game.." wait(.1) end game.StarterGui.Wait.Frame.TextBox1.Text = "Starting Game.." wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Starting Game..." wait(.1) end game.StarterGui.Wait.Frame.TextBox1.Text = "Starting Game..." wait(2) for i = 1, #plrs do plrs[i].Character:MoveTo(Tp.Position) if plrs[i]:findFirstChild("leaderstats") ~= nil then plrs[i].leaderstats.Cash.Value = plrs[i].leaderstats.StartCash.Value end wait(.1) end print("Wait") for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "1 Minute to decide teams" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Docks will soon be deleted" wait(.1) end game.StarterGui.Wait.Frame.TextBox.Text = "Teams must consist of 2 players" game.StarterGui.Wait.Frame.TextBox1.Text = "1 Minute to decide teams" print("Waiting for teams to be decided") DC = game.Workspace.Doors:GetChildren() wait(60) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Teams Decided" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Docks are being deleted" wait(.1) end game.StarterGui.Wait.Frame.TextBox1.Text = "Teams Decided" game.StarterGui.Wait.Frame.TextBox.Text = "Docks are being deleted" print("Teams Decided") wait(5) for i = 1, #Dockss do Dockss[i].Transparency = .3 Dockss[i].CanCollide = false wait(.1) Dockss[i].Transparency = .6 wait(.1) Dockss[i].Transparency = 1 end for i = 1, #DC do DC[i].Head.Transparency = 1 DC[i].Head.CanCollide = false DC[i].Door.CanCollide = false DC[i].Door1.CanCollide = false DC[i].TpTo.CanCollide = false DC[i].TpTo1.CanCollide = false DC[i].NameScript.Disabled = true DC[i].Name = " " DC[i].PlayerAmount.Value = 0 end for i = 1, #Walls do Walls[i].CanCollide = false end for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = false end game.StarterGui.Wait.Frame.Visible = false print("Docks Removed") wait(60) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = true plrs[i].PlayerGui.Wait.Frame.TextBox1.Text = "Game ended" plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Points being awarded" wait(.1) end game.StarterGui.Wait.Frame.TextBox1.Text = "Game ended" game.StarterGui.Wait.Frame.TextBox.Text = "Points being awarded" wait(2) for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.TextBox.Text = "Game Restarting" wait(.1) end game.StarterGui.Wait.Frame.TextBox.Text = "Game Restarting" for i = 1, #plrs do plrs[i].PlayerGui.Wait.Frame.Visible = false wait(.1) end game.StarterGui.Wait.Frame.Visible = false AllBoats:remove() for i = 1, #plrs do plrs[i].Character:MoveTo(game.Workspace.SpawnLocation.Position) if plrs[i]:findFirstChild("leaderstats") ~= nil then plrs[i].leaderstats.Cash.Value = 0 end wait(.1) end end end end end
LMaD(quit) - 600 posts SH - 200
|
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 08 Jul 2012 11:01 PM |
plz help x-x
LMaD(quit) - 600 posts SH - 200 |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 09 Jul 2012 12:04 AM |
dont tell me what to do btw i fixed it... dont even know what i did... so complicated
LMaD(quit) - 600 posts SH - 200 |
|
|
| Report Abuse |
|
|