Set TextLabel transparency to Part transparency when changed

image

I would like to have this TextLabel’s transparency to be equal with the transparency of ‘Head’ whenever it is changed.

My problem is I barely know how to script. Any help would be appreciated.

Thanks in advance.

Could you show your entire explorer?

put a script it in your button with this code

local Head = script.Parent:WaitForChild("Head")
local CostLabel = script.Parent:WaitForChild("ButtonLabel"):WaitForChild("CostLabel")

Head:GetPropertyChangedSignal("Transparency"):Connect(function()
 CostLabel.BackgroundTransparency = Head.Transparency
end)

Capture

if you want to make the text transparency equal to the head part transparency then change

this

 CostLabel.BackgroundTransparency = Head.Transparency

to this

 CostLabel.TextTransparency = Head.Transparency
1 Like

Make sure this code is inside a script not a localscript, Hope that works with you!

local Part = script.Parent.Parent.Parent -- The Part
local Label = script.Parent -- The TextLabel

wait()
Label.BackgroundTransparency = Part.Transparency
Part:GetPropertyChangedSignal("Transparency"):Connect(function() -- Connects when the located part's "Transparency" is changed
	Label.BackgroundTransparency = Part.Transparency -- Sets the label's BackgroundTransparency to the same value of the part's Transparency
end)

thanks. That worked

idk why the video is wacky like that but oh well.

1 Like