How to disable a screengui via local script?

So I was on studio trying to make an opening to a game, which has a screen gui followed by a text label, so I added a script that waited 7 seconds before going into game.startergui.screengui.enabled = false
however, once the game launched and 7 second elapsed, the screengui was still showing on screen. I went into studio and it turns out it went on my character; so now im trying to come up with a local script so it detects a local player on the client and disable the gui that way. Can someone help me start with this?
Like im not very good with local scripts so I guess my question here is what counts as a local player?

1 Like

Any object, if placed in StarterGui will transfer to each client’s PlayerGui

1 Like

You cannot do

game.StarterGui.ScreenGui

You have to find it with Parent. ie:

script.Parent.Parent.Parent.ScreenGui
3 Likes

If your LocalScript is a member of the GUI, you can simply do:

script.Parent.Enabled = false
2 Likes

Or, like I said before

local PlayersService = game:GetService("Players");
local LocalPlayer = PlayersService.LocalPlayer;
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui", 10);
local ScreenGui = PlayerGui:WaitForChild("ScreenGui", 10);
ScreenGui.Enabled = false;
4 Likes