Transparancy Tool Change Gui

Trying to make a gui for a cafe.

Im Trying to make a gui button that when i click it changes the Transparancy of the tool im holding.

heres the code tell me what im doing wrong local MainGui = script.Parent
local TextButton = MainGui.TextButton

	if h.Parent.Name == "Pizza" then
		h.Parent.Name = "Pizza"
		h.Parent.pesto.Transparency = 0



Ive tried Parent/functions and none seem to be working.

This “C” is suppose to be a capital.


it doesnt matter but yes Connect is much better because connect is deprecated but it still works

what does this (h) define? its not meant for the pizza but you who clicked so your trying to set yourself transparent but not the pizza

ive been learning from other scripts and thats what it had

Something like this might work:

local tool = (toolobject)


tool.Transparency = 1


Is there a way to make just one part in the tool to change Transparency?

Yes, get the child of the tool:

tool.SomeChild.Transperency = 1

no no no this (h) means anything that clicked the button and the one who clicked means yourself so your the script is trying to set yourself transparent but not the pizza or am i getting this wrong?

No, you are right, the h is defining the user who is running the function.

nothing is working im not sure what im doing wrong im using a local script Parented with a textButton

Can you send me the tool’s children from explorer?

as Loki said try make a variable of your tool path and then set its properties from the click

1 Like


Okay, so here is the script you want to write.

local tool = game.StarterPack.Pizza
local pesto = tool.pesto

pesto.Transperency = 1

1 Like

its not turning the Transperency to 1 for the pesto when i click the textbutton here is what i got setup a6b92ff5ec67fcb4b87fa328c31cf08a

Okay, I think I know whats wrong.
First of all, can you send me errors your getting, then try putting the LocalScript inside of the Textbutton

i put it in the textbutton and this is what i got 4427ba932f25e7ef419142a4385c7b74

I think I mispelled Transparent.

Yes, I am terribly sorry, I mispelled Transparency, replace it and it should work.