generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Item Remove Gui?

Previous Thread :: Next Thread 
RogueBob is not online. 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
Lightmaster9 is not online. Lightmaster9
Joined: 14 May 2009
Total Posts: 8659
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
Megamatrixdude is not online. Megamatrixdude
Joined: 06 Dec 2009
Total Posts: 10939
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 is not online. 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
Megamatrixdude is not online. Megamatrixdude
Joined: 06 Dec 2009
Total Posts: 10939
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image