Help with Frame code

I have defined Frame in several different ways with several different "Visible “BackgroundTransparency” “Transparency”, Visible and BackgroundTransparency work but not in the code, only in properties.
Can someone correct my code so it works?

game.StarterGui.ScreenGui.Frame.Visible = false

1 Like

do you use BackgroundTransparency or visible ?

i’ve tried both. they don’t work even though they work in properties

1 Like

hmm, can you show some screen shot or full code ?

That’s the code, screenshots are not working right now for me.

The issue is that you’re accessing StarterGui instead of Player.PlayerGui.

1 Like

ohh yeah i agree, this will help you @WaterCanxiety :slight_smile:

Can you elaborate on that, it’s giving me the “Player is not a valid member of DataModel” and not doing its intended purpose, do I just define it like this: game.Player.StarterPlayer.Frame.Visible = false or game.Player.StarterPlayer.ScreenGui.Frame.Visible = false. Or is it something else.

Is this script or localscript?

if it’s local script then you need to define local player first like this

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")

ScreenGui.Frame.Visible = false

tell me if it’s not local script tho

Are you trying to use this to change the frame while playing?
You are not defining your frame properly, the screengui is moved from the server to the player itself so looking for the frame in “game.StarterGui” won’t work.

I noticed this solution has been given a couple of times already so please mark one as “Solution”.

It should only be game.Players.LocalPlayer.PlayerGui.

oh it works thank you so much!!