|
| 09 Jun 2012 05:53 PM |
It works fine, but no matter what, it always picks the first map i put in "Maps" Help?
Maps = {"The Mound","Teh epic","Jaginator Style"} random = Maps[math.random(1,#Maps)]
while true do wait(20) script.map.Value = random local m = Instance.new("Message") m.Parent = game.Workspace m.Text = "Choosing a map.." wait(5) m.Text = random.." Has been chosen!" wait(4) g = game.Lighting[script.map.Value]:Clone() g.Parent = game.Workspace g:MakeJoints() m.Text = "New round started!" wait(3) m:remove() local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i].TeamColor == BrickColor.new("Bright Blue") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then-- change to team1's TeamColor script.Parent.What.Disabled = false elseif pplz[i].TeamColor == BrickColor.new("Bright red") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then--change to team2's TeamColor script.Parent.What.Disabled = true end end wait(50) local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then script.Parent.What.Disabled = false end end
local m = Instance.new("Message") m.Parent = game.Workspace m.Text = "Game ends in: 10" wait(1) m.Text = "Game ends in: 9" wait(1) m.Text = "Game ends in: 8" wait(1) m.Text = "Game ends in: 7" wait(1) m.Text = "Game ends in: 6" wait(1) m.Text = "Game ends in: 5" wait(1) m.Text = "Game ends in: 4" wait(1) m.Text = "Game ends in: 3" wait(1) m.Text = "Game ends in: 2" wait(1) m.Text = "Game ends in: 1" wait(1) m.Text = "Game ends in: 0" wait(1) m.Text = "Game ended!" wait(4) game.Workspace[script.map.Value]:remove() m:remove() end
|
|
|
| Report Abuse |
|
|
|
| 09 Jun 2012 07:13 PM |
| bump, i don't know what went wrong |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Jun 2012 07:24 PM |
| ugh i don't see a problem! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 09 Jun 2012 07:55 PM |
| plz just one person take a guess on what may be wrong |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2012 07:57 PM |
| You defined 'random' before the Script started, so that means 'random' will always be the Same value each time. Define random in the loop. |
|
|
| Report Abuse |
|
|
orca101
|
  |
| Joined: 11 Sep 2009 |
| Total Posts: 6624 |
|
|
| 09 Jun 2012 07:58 PM |
This is because the random value is outside of the while loop, therefore once the script runs the value is picked and never changes.
-The Unknown Forumer- |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Jun 2012 08:11 PM |
Okay, instead of a message i made it a hint, and now it doesn't work, help?
Maps = {"The Mound","Teh Epic","The Seizure","Lava Map"}
while true do random = Maps[math.random(1,#4)] wait(20) script.map.Value = random local m = script.Parent.Hint m.Text = "Choosing a map.." wait(5) m.Text = random.." Has been chosen!" wait(4) g = game.Lighting[script.map.Value]:Clone() g.Parent = game.Workspace g:MakeJoints() m.Text = "New game started!" wait(3) m:remove() local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i].TeamColor == BrickColor.new("Bright Blue") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then script.Parent.What.Disabled = false elseif pplz[i].TeamColor == BrickColor.new("Bright red") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then script.Parent.What.Disabled = true end end wait(50) local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then script.Parent.What.Disabled = false end end
local m = script.Parent.Hint m.Text = "Game ends in: 10" wait(1) m.Text = "Game ends in: 9" wait(1) m.Text = "Game ends in: 8" wait(1) m.Text = "Game ends in: 7" wait(1) m.Text = "Game ends in: 6" wait(1) m.Text = "Game ends in: 5" wait(1) m.Text = "Game ends in: 4" wait(1) m.Text = "Game ends in: 3" wait(1) m.Text = "Game ends in: 2" wait(1) m.Text = "Game ends in: 1" wait(1) m.Text = "Game ends in: 0" wait(1) m.Text = "Game ended!" wait(4) game.Workspace[script.map.Value]:remove() m:remove() end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 09 Jun 2012 08:35 PM |
I think this would work:
Maps = {"The Mound","Teh Epic","The Seizure","Lava Map"} while true do random = Maps[math.random(1,#Maps)] wait(20) local m = script.Parent.Hint m.Text = "Choosing a map.." wait(5) m.Text = random.." Has been chosen!" wait(4) g = game.Lighting[random]:Clone() g.Parent = game.Workspace g:MakeJoints() m.Text = "New game started!" wait(3) m:remove() local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i].TeamColor == BrickColor.new("Bright Blue") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then script.Parent.What.Disabled = false elseif pplz[i].TeamColor == BrickColor.new("Bright red") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then script.Parent.What.Disabled = true end end wait(50) local pplz = game.Players:GetChildren() for i = 1,#pplz do if pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then script.Parent.What.Disabled = false end end local m = script.Parent.Hint m.Text = "Game ends in: 10" wait(1) m.Text = "Game ends in: 9" wait(1) m.Text = "Game ends in: 8" wait(1) m.Text = "Game ends in: 7" wait(1) m.Text = "Game ends in: 6" wait(1) m.Text = "Game ends in: 5" wait(1) m.Text = "Game ends in: 4" wait(1) m.Text = "Game ends in: 3" wait(1) m.Text = "Game ends in: 2" wait(1) m.Text = "Game ends in: 1" wait(1) m.Text = "Game ends in: 0" wait(1) m.Text = "Game ended!" wait(4) game.Workspace[random]:Destroy() m:Destroy() end
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2012 08:42 PM |
| Thanks KNIGHTMAREXD and everyone else who posted, i now have a better understanding on how to script and have a working script! |
|
|
| Report Abuse |
|
|
| |
|