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

How could I make a decal visible then transparent?

So I am a bit of a newb at scripting and tried out this script I made, but it doesn't seem to work. Could someone help figure it out for me?

local brick = Workspace.Decal -- Store a reference to the brick.

function onTouch(part) -- The function that runs when the part is touched. decal.Transparency = 0 wait(5) decal.Transparency = 1 end

brick.Touched:connect(onTouch) -- The line that connects the function to the event.

Thanks!

1 answer

Variables aren't really needed in this situation, because you're setting a script inside of a part that only changes that part alone. Also, just a minor correction- your variable is wrong since it's not parented by an object. So your connection line is also incorrect. Here is an example of the correct syntax;

--Note: 'script.Parent' references to the part the script is inside of

function onTouch()
script.Parent.Decal.Transparency = 1
wait(5)
script.Parent.Decal.Transparency = 0
end

script.Parent.Touched:connect(onTouch)

If you have any other questions, feel free to inbox me.

~Kyo-Chan

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