I have a ScreenGui named 'PlayerGui' and inside the gui, there is a Frame.
In a localscript under a different ScreenGui I want to hide the 'Frame' inside PlayerGui.
My script:
script.Parent.Parent.PlayerGui.Frame.Visible = false
This script doesn't work, and roblox outputs with this message: "PlayerGui is not a valid member of PlayerGui"
I tried another script:
game.StarterGui.PlayerGui.Frame.Visible = false
This script also doesn't work, and outputs with the same message.
I have double checked everything and can 100% guarantee that everything is under StarterGui and its ScreenGui.
How do I fix this problem?
When you try to change a UI in the PlayerGui of the Player, you need a LocalScript. Put this in the StarterGui
When you're in a LocalScript you can find who is the Client "Player"
LocalScript
local PlayerService = game:GetService('Players') -- This is the folder that you can see in the Explorer. Here the Players connected at your game. local Player = PlayerService.LocalPlayer -- Here you can find the Client local PlayerGui = Player:WaitForChild('PlayerGui') -- Here you find the PlayerGui. local ScreenGui = PlayerGui:WaitForChild('ScreenGui') -- Here you find the PlayerGui. ScreenGui:WaitForChild('Frame').Visible = false
StarterGui is where your ScreenGui that replicate to the Clients. You doesn't need that.