Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a button that when clicked changes the Transparency of a decal?

If possible im looking for a part that serves as a button,when clicked with a mouse a decal on a part should turn from having transparency 1 to 0, and if clicked twice it should come back to normal. I have reserched on youtube and found out how to do this with a part but the decal on the part does not change transparency with it. Could any one help me with this?

2 answers

✓ Accepted answer

You can try something like this:

local Button = script.Parent -- change this to where the button is located
local Decal = script.Parent.Parent.Decal -- change this to where the decal is located

Button.MouseButton1Down:Connect(function()
	if Decal.Transparency == 1 then
		Decal.Transparency = 0
	elseif Decal.Transparency == 0 then
		Decal.Transparency = 1
	end
end)

4 comments

0

Sory but could you explain if im duposed to delete the last parent and decal and put the model of the button and the part of the decal in there or if i just put them in front or if i should put the name of the button and not the model. If yo could explain i ould be tankfull and sory for spending your time

0

Put the script inside the button. Then locate the decal by using .Parent until you reach the correct, well- Parent.

0

If you're still confused, add my discord and I'll help you out. Josh K#2740

0

Tanks it worked, it finaly worked thanks so much

Decals don't change transparency with their brick. You have to change the transparency of the decal itself. Just have the path point to the decal's transparency property.

This discussion is preserved as it was. New answers, comments, and votes are closed.