Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Decal and part transparency?

Asked by 4 years ago

I need to make the decal go transparent with the decal. And also add a glass smashing noise.

01local debounce = false
02script.Parent.Anchored = true -- Anchores brick
03script.Parent.ClickDetector.MouseClick:Connect(function()
04    if debounce == false then
05        debounce = true
06        script.Parent.Transparency = 1 -- Makes Block Invisible
07        script.Parent.CanCollide = false -- Lets Player Walk Through Block
08 
09        debounce = false
10    end
11end)

I do not know Lua, I copypasted this code. Give me what I need to add. I'll try to learn it.

0
You can make a decal transparent by doing decal.Transparency = 1 rabbi99 714 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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:

01local id = 69; -- // Number value
02local debounce = false
03script.Parent.Anchored = true -- Anchores brick
04script.Parent.ClickDetector.MouseClick:Connect(function()
05    if debounce == false then
06        local s = Instance.new("Sound");
07        s.Parent = script.Parent;
08        s.SoundId = "rbxassetid://" .. id;
09        s:Play();
10        debounce = true
11        script.Parent.Transparency = 1 -- Makes Block Invisible
12        script.Parent.Decal.Transparency = 1; -- // Change to your decals hierarchy position
13        script.Parent.CanCollide = false -- Lets Player Walk Through Block
14        debounce = false
15    end
16end)
Ad
Log in to vote
-1
Answered by 4 years ago

This will make the decal invisible and it will play sound when it smashes.

01local SmashSfx = Instance.new("Sound")
02SmashSfx.Parent = script.Parent
03SmashSfx.SoundId = "rbxassetid://" -- Put the id here
04SmashSfx.Volume = 1 -- Change the volume of the Audio/Sound
05SmashSfx.Looped = false -- Keep this false
06SmashSfx.Archivable = false -- Also keep this false
07 
08 
09local debounce = false
10script.Parent.Anchored = true -- Anchores brick
11script.Parent.ClickDetector.MouseClick:Connect(function()
12    if debounce == false then
13        debounce = true
14        script.Parent.Transparency = 1 -- Makes Block Invisible
15        script.Parent.CanCollide = false -- Lets Player Walk Through Block
View all 21 lines...
0
Explain your answer. WideSteal321 773 — 4y

Answer this question