Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Why won't this work???

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Here is my script. Obviously there are 18 other if statements.

while true do
 wait(5) 
 m = Instance.new("Message") 
 local players = game.Players:GetChildren()
 -- This was useless

 if NumPlayers > 1 then -- What you had it set up.. It would only work only if it generated a 1. 
  math.random(1,18)
if num==1 then-- Map 1
  m.Parent = game.Workspace 
  m.Text = "Choosing Map..."
  wait(3)
  m.Text = "Map is 'The Classic Map', made by Anth4598"
  wait(3)
  m.Text = "This was the first map ever made for Blitz"
  wait(3)
  m.Text = "The Blitz will keep going until only 1 person remains.(goes for 30 seconds in beta)"
  wait(3)
  m.Text = "The weapon chosen is a sword."
  m.Parent = nil
  game.Lighting.Map1:clone().Parent = game.Workspace  
  for i = 1, # players do
   players[i].Character:MoveTo(Vector3.new(-7, 9.8, -4))
   game.Lighting.LinkedSword:clone().Parent = players[i].Backpack 
  end
  wait(30) 
    players[i].Character:MoveTo(Vector3.new(-169, 5.6, 27))
  game.Workspace.Map1:Remove() 
  m.Parent = game.Workspace
  m.Text = "Blitz over!"
  wait(3)
  m.Text = "You have 1 minute until the start of the next Blitz."
  wait(3)
  m.Parent = nil
    m:remove()
end
else -- This below will make it so the script shouldn't break if there is less then 2 players.
m.Text = "Need more then 1 player to start!"
wait(5)
m:Destroy()

Thanks!

0
What's wrong with it? Glancing at that code, I can't see anything bugged. (Also, instead of if-end if-end, use if-elseif-end) adark 5487 — 9y

2 answers

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Did y ou define NumPlayers on line 7? Take a look at line 8. You forgot 'num=' to set the variable which is called in the following if statements.

Ad
Log in to vote
0
Answered by 9 years ago

You're missing a few variables that you need to define. NumPlayers needs to be defined in a variable. For example,

NumPlayers = #players

would set NumPlayers to the amount of children in the Players section, as defined by the players variable.

Also, num is undefined as well. I'm not sure what you wanted to do on that line, but find a variable for it.

Answer this question