While loop doesnt break after conditions arent met?

Hi Other Developers,
Here is my code:

while Player.PlayerGui.LoadingScreen.Background.BackgroundTransparency < 1 do
    task.wait()
end

even after the Background is transparent the while loop still doesn’t break.

more info:

  • This code is in a serverscript
  • uh idk if you want more info about the setup the tell me

Thanks a lot.

If you move it to the client it should work. I think I had this problem before and it fixed when I tested it on the client.

1 Like

can’t really move it to client, because then I have to change like 300 lines of code.

I mean you can just make a remote event for that and fire it when it gets to that point in the code and make it repeat until its transparent

Its super hacky but it might work

If you’re trying to change (or detect changes of) a client object, like a Gui, then the behavior might not be replicating to the client/server the way you expect. Try using a RemoteEvent to send a message to the server from a LocalScript, using the LocalScript to detect when something changes on the client object (the Gui.)

The transparency only changes for the client, so the Server wouldn’t see it. Like others mentioned, you would probably have to use RemoteEvents or somehow server-client communication

If you are changing the transparency on the client then the server will not see that.

I changed Size on client and it does not replicate to server

Client Sees:

Server Sees:

So you would either have to
A: Change to a local script
B: Use Remotes

1 Like