robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 23 Jul 2012 11:07 PM |
this removes 3 hats of the 6 i have in Lighting?
Will this work?
local cx = game.Lighting:GetChildren() for i=1,#cx do if cx[i].className == "Hat" then cx[i]:clone().Parent = Fusion end end wait() if Fusion.Hat1 then Fusion.Hat1:remove() end if Fusion.Hat2 then Fusion.Hat2:remove() end if Fusion.Hat2 then Fusion.Hat2:remove() end |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 23 Jul 2012 11:19 PM |
Will this work?
local cx = game.Lighting:GetChildren() for i=1,#cx do if cx[i].className == "Hat" then cx[i]:clone().Parent = Fusion end end wait() local cxx = game.Lighting:GetChildren() for i=1,#cxx do if cxx[i].className == "Hat" then local cxx2 = cxx[math.random(1,#cxx)] cxx2[i]:remove() end end |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 23 Jul 2012 11:20 PM |
That doesn't appear as if it will work, as you would always remove "Hat1" and "Hat2" (If you wanted it to be random). I'd suggest something like this:
local hats = game.Lighting:GetChildren()
for i = 1,3 do -- For three hats local hat = hats[math.random(1, #hats)] -- Get a random hat hat:Destroy() -- Remove the hat end
-- That will leave three hats in game.Lighting. -- If you want it in a certain model, clone them first, then -- Make 'hats' the clones instead of them in Lighting. |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 23 Jul 2012 11:29 PM |
local hats = game.Lighting:GetChildren() for i=1,#hats do if hats[i].className == "Hat" then local hat = hats[math.random(2, 3)] -- Get a random hat hat[i]:clone().Parent = Fusion end end
I just made up that, which is better |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Jul 2012 11:31 PM |
^
You never defined Fusion.
You say
math.random(2,3)
Which means, it wil only take hat 2 or hat 3. Never hat one.
|
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 23 Jul 2012 11:34 PM |
@miz My point is to get all the hats in Fusion. Then delete 3 or 4.
But i made a diff one that just gives 2 or 3. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 24 Jul 2012 02:23 AM |
local cx = game.Lighting:GetChildren() for i=1,#cx do if cx[i].className == "Hat" then Fusion = cx[i]:clone().Parent end end hats = Fusion:GetChildren() l = #Fusion for h = 1, 3 do x = math.random(1, l) hats[x]:Destroy() end
Not sure if that will even work but I tried something. |
|
|
| Report Abuse |
|
|