Hello. This is my first time scripting and asking a question, so I probably did a simple mistake. I am making a prank game where the image flashes to make it look animated, but when I enter my code in a script and play it in roblox studio:
ib = game.StarterGui.ScreenGui.Frame.Black
iw = game.StarterGui.ScreenGui.Frame.White
fr = game.StarterGui.ScreenGui.Frame
fr.Visible = false
while wait() do
fr.Visible = true
iw.Visible = true
ib.Visible = false
wait(.5)
iw.Visible = false
ib.Visible = true
wait(.5)
print("this looped")
end
and I run the game, the visibility box is checking on and off, but the image doesn't turn invisible and not "flashing". I made this a script not a local script. (I already tried localscript and it was the same problem) Here is my explorer: https://imgur.com/ssDYpky
Here is what the script does: https://imgur.com/INxS7II
and here is what I want it to do: https://imgur.com/5CvpR8I
Please help me find a solution to why it doesn't work and what to do to make it work

4 comments
This isn't an answer to the question, it's a rambling of personal dogma, half of which is based on misunderstandings. Server scripts can change individual players' UI, that's not why this code should be in a LocalScript. Responsiveness is why. Items 3 and 4 are misinformation. Item 6 is wrong; you can't make a variable reference to a UserData property like Visible. Item 5.. ironic.
Thank you for your help!
I dont know how to personally say this, but yeah she's totally right! Until I saw this comment didnt actually know about any of this. Which is why im kinda glad i got to see it. What she says is way better than what I said..and actually right. Though, I don't get how 3 and 4 are misinformation (If you Could explain a bit more). I'll be taking out the items which are Inaccurate.
Also, for the dogma, very sorry if it came out that way. Was really doing my best to explain it correctly (Even Though It Was Not). I'll do better with that, and not go on a ramble like that with incorrect information. Also, please accept her answer instead of mine. Thank You.