drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 31 Mar 2014 11:55 PM |
Can someone help me re-write the random map chooser line so that it does not pick the same map twice? Thank you. :)
while true do wait(5) local m = math.random(1,17) local player = game.Players:GetPlayers() for i = 2, #player do msg = Instance.new("Hint") msg.Parent = nil |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 31 Mar 2014 11:58 PM |
It's not random if it can't pick the same map twice, but here:
local maps = {maps...} local lastMap = 0 local randomMap = 0 repeat randomMap = maps[math.random(#maps)] until randomMap ~= lastMap lastMap = randomMap
Something like that |
|
|
| Report Abuse |
|
|
|
| 01 Apr 2014 12:00 AM |
Ohh nice.
http://www.roblox.com/Forum/ShowPost.aspx?PostID=129293695 |
|
|
| Report Abuse |
|
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 01 Apr 2014 12:16 AM |
Does this look right? I attempted it...
local LastMap = ""
function RandomMap() local m = math.random(1,#Maps) end
while true do wait(5) RandomMap() if m == LastMap then RandomMap() else local player = game.Players:GetPlayers() for i = 1, #player do |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Apr 2014 12:24 AM |
No
local LastMap = 0 local map = nil
function RandomMap() m = math.random(1,#Maps) end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Apr 2014 12:25 AM |
| local m = nil* (not local map = nil) |
|
|
| Report Abuse |
|
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 01 Apr 2014 12:42 AM |
| Was everything below that ok? |
|
|
| Report Abuse |
|
|
|
| 01 Apr 2014 12:45 AM |
Two questions: 1.) Why did you copy the script from the op in the link provided? 2.) Why are you trying to help if you can`t tell if that simple script that cnt posted has any errors? |
|
|
| Report Abuse |
|
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 01 Apr 2014 12:50 AM |
| I meant the script I posted... was the rest of it ok below what cnt corrected? |
|
|
| Report Abuse |
|
|
|
| 01 Apr 2014 12:52 AM |
| That still doesn`t answer question one. If that`s your alt/main then my new questions is "Why did you make another thread?" |
|
|
| Report Abuse |
|
|