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

Why isn't this script working?

Asked by 10 years ago

This script looks fine to me and a bunch of other people said it is okay. But when I go in a game, it just won't work! Please tell me what's wrong with it! I would just look at the output box, but when I click 'Play Solo' in Studio it crashes because Studio is annoying. Please help me!!!! The script is supposed to spawn the map, do a bunch of message things, teleport the player, wait for 30 secs then tp the player back. It is also supposed to change the player's team to In the Blitz the change it back to Lobby, could someone help me with that too? Finally, right now when I go into the game nothing happens, so something is wrong in the beginning of the script. Here is the script

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


 if NumPlayers > 1 then ] 
  math.random(1,18)
if num==1 then-- there are 18 other 'if' statements
  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()
end
end
0
That is a vague description, tell us what is supposed to happen and what happens instead. Lacryma 548 — 10y

1 answer

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

You didn't define NumPlayers and num...

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


 if NumPlayers > 1 then
  num = math.random(1,18)
if num==1 then-- there are 18 other 'if' statements
  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()
end
end

0
OMIGOSH thank you so much! Antharaziia 75 — 10y
Ad

Answer this question