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

I'm trying to make a part's decal appear every certain amount of seconds?

Asked by 7 years ago

I'm trying to make it so a decal's transparency changes to 0 every 2 minutes, how do I do this?

1 answer

Log in to vote
1
Answered by 7 years ago

Assume script.Parent is where the decal resides in, Decal have a property called Transparency so fairly simple.

To create a endless loop you must use "while true do".

1decal = script.Parent.Decal -- refers and sets a variable for the Decal, the decal will be named Decal of course.
2 
3while true do
4    wait(120) -- 2 minute wait
5    script.Parent.Decal.Transparency = 0
6end

This is what you specified, but if you want it to always fade and come back again endlessly, where it becomes fully visible in a 2 minute wait this is a proper script:

1decal = script.Parent.Decal
2 
3while true do
4    for i = 1, 0, -0.00833333333 do
5        decal.Transparency = i
6    end
7end

But if not that then you just want a regular script that instantly turns decal invisible and visible once again then this is the script:

1decal = script.Parent.Decal
2 
3while true do
4    script.Parent.Decal.Transparency = 1
5    wait(120)
6    script.Parent.Decal.Transparency = 0
7end
0
Also note, that if you are doing "while true do" loops in the future, they must have a wait() otherwise they crash since it would infinitely run the script at once. User#18043 95 — 7y
Ad

Answer this question