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

0

Theres no need to use playergui because startergui gets is what gets cloned to playergui.

0

Can we get a massive sign somewhere? Or just throw StarterGui in the trash because this happens t o o often.

0

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.

0

Oh.

0

dang 4330 rep thats alot

0

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.