Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't this script work?

This script won't work! Could someone please help me!!

NumPlayers = game.Players.NumPlayers
 m = Instance.new("Message")
local i = 0
repeat
i = i + 1
 local players = game.Players:GetChildren()

 if NumPlayers > 1 then -- What you had it set up.. It would only work only if it generated a 1. 
  num = math.random(1,2)
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
if num==2 then
  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 Superball."
  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.Superball: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

wait(1)
until i >= 10000
m.text("This server is shutting down for an update")
for _, v in ipairs(Game.Players:GetPlayers()) do
    v:Kick()
end

4 comments

0

Please explain what happens when you try to run the script and where the script is located.

0

Format your code with the Code Block button please.

0

What Ekkoh said. I can't help what I can't read.

0

Sorry, I thought I pressed the button... must've glitched or something. I'll re-post today.

1 answer

NumPlayers = game.Players.NumPlayers m = Instance.new("Message") local i = 0 repeat i = i + 1 local players = game.Players:GetChildren()

if NumPlayers > 1 then -- What you had it set up.. It would only work only if it generated a 1. num = math.random(1,2) 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 if num==2 then 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 Superball." 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.Superball: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

wait(1) until i >= 10000 m.text("This server is shutting down for an update") for _, v in ipairs(Game.Players:GetPlayers()) do v:Kick() end

Here is formatted version so people can answer it. I don't know the answer, this is just the formatted version.

This discussion is preserved as it was. New answers, comments, and votes are closed.