Help with a if statement script

Hi,

What I want to make

so im saying if the scripts parent is visible then it will do the following, wait 1 second, make “Flash” appear, then wait .1 seconds, then it makes the “part” invisible then “Flash” invisible then the “letter” visible, then make the “letter” unanchored.

What the issue is

the script is perfectly fine and I don’t under stand the issue. I hope you guys can help me resolve this(the output didn’t confirm an error)

Location

Screen Shot 2021-03-19 at 10.21.22 AM

Script

if script.Parent.Transparency == 0 then
    wait(1)
    script.Parent.Parent.Flash.Transparency = 0
    wait(5)
    script.Parent.Transparency = 1
    script.Parent.Parent.Flash.Transparency = 1
    script.Parent.Parent.letter.Transparency = 0
    script.Parent.Parent.letter.Anchored = false
end

I hope you can help me!

From,
Mista

It might be due to the script only running once when it starts.

script.Parent:GetPropertyChangedSignal("Transparency"):Connect(function()
    if script.Parent.Transparency == 0 then
       wait(1)
       script.Parent.Parent.Flash.Transparency = 0
       wait(5)
       script.Parent.Transparency = 1
       script.Parent.Parent.Flash.Transparency = 1
       script.Parent.Parent.letter.Transparency = 0
       script.Parent.Parent.letter.Anchored = false
   end
end)

This will make the code run everytime the transparency is changed

1 Like

Thank you! This worked. Im not quite a good scripter. Can you explain to me what script.Parent:GetPropertyChangedSignal(“Transparency”):Connect(function() means?

In short, it’s basically telling the scirpt to run whatever is inside of the event if Transparency changes

GetPropertyChangedSignal creates a signal that is fired everytime the property is changed.

Oh. Oki. Thanks guys! Also hi Embat!

1 Like

Hello! Saw you needed an explanation so I came to give a bit of help as well, sorry about that @Jxl_s!

2 Likes