My script fails

Hi, I wanted you to help me with something, I have a script that should make a UI visible only to me, but for some reason people ONLY SEE THE UI if you restart the character, but I don’t understand why. Here the script I use:

local Player = game:GetService("Players"):GetPlayerByUserId(327893153)

local gui = script.Parent.Frame

if Player then

gui.Visible = true

else

gui.Visible = false

end

(I speak Spanish, sorry for the bad English) I don’t know if I put it in the correct category, if I’m wrong, please correct me.

Are you sure, you are naming your GUI correctly? The script worked fine for me maybe it’s because the script isn’t formatted right.
I formatted it like this and it worked fine for me.
local Player = game:GetService("Players"):GetPlayerByUserId(218272425)

local gui = script.Parent.TextButton

    if Player then

    	gui.Visible = true

    else

    	gui.Visible = false

    end

I also did it inside a local script maybe that would make a difference.

1 Like

Use prints and see if it prints in the else statement.