RogueBob
|
  |
| Joined: 22 Nov 2009 |
| Total Posts: 178 |
|
|
| 20 Jul 2011 06:23 AM |
I have a GUI that is supposed to remove a certain tool in your backpack when a button inside the GUI is clicked. It's not working, any ideas why?
T1 = script.Parent.Parent.Parent.Backpack.Plank x1 F = script.Parent.Parent.Parent
function Removal() if F.Parent.Backpack:findFirstChild("T1") ~= nil then F.Parent.Backpack.T1:remove() end
end
script.Parent.MouseButton1Click:connect(Removal)
|
|
|
| Report Abuse |
|
|
|
| 20 Jul 2011 07:05 AM |
if F.Parent.Backpack:findFirstChild("T1") ~= nil then You don't use variables ofr the ':findFirstChild()'s. Use 'script.Parent.Parent.Parent.Backpack:findFirstChild("Plank x1")'. |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2011 07:11 AM |
F = script.Parent.Parent.Parent
function Removal() if F.Backpack:FindFirstChild("Plank x1") ~= nil then T1:remove() end
end
script.Parent.MouseButton1Click:connect(Removal)
-My hand is a dolphin |
|
|
| Report Abuse |
|
|
RogueBob
|
  |
| Joined: 22 Nov 2009 |
| Total Posts: 178 |
|
|
| 21 Jul 2011 06:25 AM |
T1 = script.Parent.Parent.Parent.Backpack.Plank x1
function Removal() if script.Parent.Parent.Parent.Backpack:findFirstChild("Plank x1") ~= nil then T1:remove() end
end
script.Parent.MouseButton1Click:connect(Removal)
This is what I've gathered from both of your info.
|
|
|
| Report Abuse |
|
|
|
| 21 Jul 2011 11:50 AM |
You can't access things like that with spaces. You have to use square brackets, like so:
lol.rofl["Omg hax"].lolwut
Notice a period only AFTER the brackets, but not before.
-My hand is a dolphin |
|
|
| Report Abuse |
|
|