How to make a button that changes a decal on click?

I am currently figuring out a way to make a script that allows me to click on a part, then it proceeds to change the Texture of a Decal on another part.

2 Likes
local Button = (location)
local Decal = (location)

Button.MouseButton1Click:Connect(function()
	Decal.TextureId = ""--Here is change
end)
3 Likes

Add ClickDetector to Part
Add Script to Part
Add Code to Script:
_ {
local Part = script.Parent
local ClickDetector = Part.ClickDetector
local OtherPartWithDecal = Part.Parent["THEOTHERPARTNAMEHERE"]
local OtherPartDecal = OtherPartWithDecal.Decal
local DecalIdToChangeTo = WRITE_YOUR_DECAL_ID_HERE

DecalId = "http://www.roblox.com/asset/?id="..tostring(DecalIdToChangeTo)
ClickDetector.MouseClick:Connect(function(_plr)

    OtherPartDecal.Texture = DecalId -- Changed Decal

end)
} _

Above code for Decal only!
Change the THEOTHERPARTNAMEHERE to the other Part with the decal in it that you want to change.
Change the WRITE_YOUR_DECAL_ID_HERE to a valid roblox decal Id,for example you can replace it with: 26424652 which is a happy face.

Reference from the Developer Hub [Old Website?]: [Decal] scroll to the bottom!

2 Likes