drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
|
| 22 Feb 2016 03:43 AM |
The last character in the script that says "Naruto" is the name of a frame. However, I have multiple frames with different names, and I need this script to be able to search all the frames for a tool. I am not sure how to do this can someone please help me?
Thank you!
player = script.Parent.Parent.Parent backpack = player.Backpack
function chooseClass(class) for i, v in pairs(backpack:GetChildren()) do v:remove() end for i, v in pairs(class:GetChildren()) do if v:IsA("Tool") then v:clone().Parent = backpack elseif v:IsA("HopperBin") then v:clone().Parent = backpack end end script.Parent.Characters.Naruto.Visible = true wait(0.01) script.Parent.Characters.Naruto.Visible = false end
for i, v in pairs(script.Parent.Characters.Naruto:GetChildren()) do v.MouseButton1Up:connect(function () chooseClass(v) end) end |
|
|
| Report Abuse |
|
|
| |
|
oni0n
|
  |
| Joined: 04 Nov 2012 |
| Total Posts: 2975 |
|
|
| 22 Feb 2016 05:22 AM |
^
use the Tool instance instead
#code cout << "Truth shall sit upon the lips of a dying man" << endl; //Matthew Arnold |
|
|
| Report Abuse |
|
|
|
| 22 Feb 2016 05:41 AM |
| Why not actually use classes? |
|
|
| Report Abuse |
|
|
drc3
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 1284 |
|
|
| 22 Feb 2016 07:30 PM |
| Can someone make me a script that assigns a weapon/tool when a gui button is clicked then? Please and thank you! |
|
|
| Report Abuse |
|
|