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

How could I make a decal visible then transparent?

Asked by 10 years ago

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

Log in to vote
1
Answered by 10 years ago

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

Ad

Answer this question