ExoCross
|
  |
| Joined: 26 Jan 2011 |
| Total Posts: 179 |
|
|
| 01 Feb 2012 04:33 PM |
Is this possible?
My try:
table = {apple, orange, grapes}
if player.Backpack:FindFirstChild(table) then
?
† KMXD † |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 01 Feb 2012 04:39 PM |
No. You can do something like this though.
table = {"apples","orange","grapes"} for i,v in pairs(table) do if player.Backpack:FindFirstChild(v) then --code end end
|
|
|
| Report Abuse |
|
|
ExoCross
|
  |
| Joined: 26 Jan 2011 |
| Total Posts: 179 |
|
|
| 01 Feb 2012 04:41 PM |
| Cool, so if there;s more than one item in the table in the backpack, the one that shows up first will be picked? Eh doesn't matter, I'll just access it from backpack, to ensure there;s only one :P |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 01 Feb 2012 04:43 PM |
| That'll go through all the things in the table and if anything in that table is in the Backpack then it'll run the code. Not the first thing that comes up anything that comes up. |
|
|
| Report Abuse |
|
|
ExoCross
|
  |
| Joined: 26 Jan 2011 |
| Total Posts: 179 |
|
|
| 01 Feb 2012 04:50 PM |
Another thing, can you clone things multiple times?
Like a = game.Lighting.Apple:Clone() a.Parent = workspace
Could you clone "a" (apple) again? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 01 Feb 2012 04:53 PM |
You can clone things multiply times but you HAVE to clone them.
Example.
a = game.Lighting.Apple:Clone() a.Parent = workspace
That example would work. Though if you did something like this
a = game.Lighting.Apple a.Parent = Workspace
You can't clone that from lighting anymore because it's already in Workspace and you forgot to clone it.
Btw you can just say this.
game.Lighting.Apple:Clone().Parent = Workspace |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2012 04:58 PM |
table = {"apple","pear","idk"} tab = table[math.random(1,#table)] tabular = game.Lighting:FindFirstChild(tab) if tabular then tabular:clone().Parent = game.Workspace end
|
|
|
| Report Abuse |
|
|
ExoCross
|
  |
| Joined: 26 Jan 2011 |
| Total Posts: 179 |
|
|
| 01 Feb 2012 05:05 PM |
So would this work?
a = game.Lighting.Apple a:Clone().Parent = workspace a:Clone().Parent = workspace
? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 01 Feb 2012 05:06 PM |
@flappy
Why not let him try to figure it out himself first? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
ExoCross
|
  |
| Joined: 26 Jan 2011 |
| Total Posts: 179 |
|
|
| 01 Feb 2012 05:08 PM |
@Flap
Thanks, but no. These questions aren't related. Though how would you clone more than 1 thing in workspace? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 01 Feb 2012 05:09 PM |
@exorcross
Either keep on rewriting that simple 1 line code or a for loop. |
|
|
| Report Abuse |
|
|
ExoCross
|
  |
| Joined: 26 Jan 2011 |
| Total Posts: 179 |
|
|
| 01 Feb 2012 05:11 PM |
Oh, so just
for i = 1, 5 do local a = game.Lighting:FindFirstChild("Apple") a.Parent = workspace end
? |
|
|
| Report Abuse |
|
|
dirk29
|
  |
| Joined: 26 May 2010 |
| Total Posts: 1142 |
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 01 Feb 2012 05:14 PM |
for i = 1,5 do a = game.Lighting.Apple a:Clone().Parent = Workspace end
Remember what I said? If you don't clone it it would error because it wouldn't be in Lighting anymore it would be in Workspace. |
|
|
| Report Abuse |
|
|
ExoCross
|
  |
| Joined: 26 Jan 2011 |
| Total Posts: 179 |
|
|
| 01 Feb 2012 05:19 PM |
| Oh, lol, keep forgeting xD |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|