I need to make the decal go transparent with the decal. And also add a glass smashing noise.
local debounce = false script.Parent.Anchored = true -- Anchores brick script.Parent.ClickDetector.MouseClick:Connect(function() if debounce == false then debounce = true script.Parent.Transparency = 1 -- Makes Block Invisible script.Parent.CanCollide = false -- Lets Player Walk Through Block debounce = false end end)
I do not know Lua, I copypasted this code. Give me what I need to add. I'll try to learn it.
To add a "glass smashing noise" you will need to first, find the id of the audio (roblox), then create a script that when your ClickDetector
event is fired, it will insert a sound instance into that part with the valid id.
To make a decal transparent it is the same as any BasePart
, simply state decal.Transparency = 1
Here is your (semi)completed code:
local id = 69; -- // Number value local debounce = false script.Parent.Anchored = true -- Anchores brick script.Parent.ClickDetector.MouseClick:Connect(function() if debounce == false then local s = Instance.new("Sound"); s.Parent = script.Parent; s.SoundId = "rbxassetid://" .. id; s:Play(); debounce = true script.Parent.Transparency = 1 -- Makes Block Invisible script.Parent.Decal.Transparency = 1; -- // Change to your decals hierarchy position script.Parent.CanCollide = false -- Lets Player Walk Through Block debounce = false end end)
This will make the decal invisible and it will play sound when it smashes.
local SmashSfx = Instance.new("Sound") SmashSfx.Parent = script.Parent SmashSfx.SoundId = "rbxassetid://" -- Put the id here SmashSfx.Volume = 1 -- Change the volume of the Audio/Sound SmashSfx.Looped = false -- Keep this false SmashSfx.Archivable = false -- Also keep this false local debounce = false script.Parent.Anchored = true -- Anchores brick script.Parent.ClickDetector.MouseClick:Connect(function() if debounce == false then debounce = true script.Parent.Transparency = 1 -- Makes Block Invisible script.Parent.CanCollide = false -- Lets Player Walk Through Block script.Parent.Decal.Transparency = 1 -- Makes the decal invisible SmashSfx:Play() -- This plays the Audio/Sound debounce = false end end)