I've made a script where basically when a player touches a part, the part makes the guis inside my screengui in startergui visible. But when I actually touch the part, I get an error that says that playergui is not a valid member of mesh part. Can someone help me? Here's the script:
--ShopGui is my screengui, Background is a frame, and ExitButton is a TextButton
gui = game:GetService("StarterGui").ShopGui
script.Parent.Touched:Connect(function(player)
player.PlayerGui:WaitForChild("ShopGui").Background.Visible = true
player.PlayerGui:WaitForChild("ShopGui").ExitButton.Visible = true
gui.Background.Visible = true
gui.ExitButton.Visible = true
end)

6 comments
Theres no need to use playergui because startergui gets is what gets cloned to playergui.
Can we get a massive sign somewhere? Or just throw StarterGui in the trash because this happens t o o often.
Also, @JesseSong, that's actually incorrect. StarterGui is just a replication container for the Server, it doesn't actually handle the User's Interface. You need to reference all GUI instances as a descendant of PlayerGUI—the authentic container for real-time UI management—to make adjustments.
Oh.
dang 4330 rep thats alot
The ScreenGui's parent is the part so the gui doesn't appear in the playergui folder which means that when I actually touch the part, the gui doesn't show up.