Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

it says "screengui not a valid member of player gui?

I used a local script here is the code:

local open = game.Workspace.openPart local close = game.Workspace.closePart local frame = script.Parent local closeButton = frame.closeButton

frame.Visible = false

local function shopMenu(otherPart) local player = game.Players:FindFirstChild(otherPart.Parent.Name)

if player then 
	player.PlayerGui.Shop_GUI.Shop.Visible = true 
	player.Character.Humanoid.WalkSpeed = 0
end

end

local function closeMenu() local player = game.Players.LocalPlayer player.PlayerGui.Shop_GUI.Shop.Visible = false player.Character.HumanoidRootPart.CFrame = CFrame.new(close.Position.X,close.Position.Y + 3,close.Position.Z) player.Character.Humanoid.WalkSpeed = 16 end

open.Touched:Connect(shopMenu) closeButton.MouseButton1Click:Connect(closeMenu)

btw where it says "screengui not a valid member of player gui" is in output

2 answers

dude from what i understand you want a gui to be opened as soon as you relate it to a part right if so use:

in StarterGui create a local script and paste the code below remember to leave your gui in properties with the frame disabled because the script will activate it and well this is a very simple script I hope I could help you if not I'm sorry.

Local player = game:GetService("Players").LocalPlayer
Local shop = workspace.YOUR TOUCH PART GO HERE

Shop.Touched:Connect(Function(hit)
 if hit.Parent == Player.Character then
Script.Parent.YOURGUINAME.Frame.Visible = true
End
End)

1 comment

0

there is a blue line under function and hit and its not working because of that

Fixed code

local open = game.Workspace.openPart 
local close = game.Workspace.closePart 
local frame = script.Parent 
local closeButton = frame.closeButton

frame.Visible = false

local function shopMenu(otherPart) 
	local player = game.Players:FindFirstChild(otherPart.Parent.Name) 
	
	if player then 
		player.PlayerGui.Shop_GUI.Shop.Visible = true 
		player.Character.Humanoid.WalkSpeed = 0
	end
end

local function closeMenu() 
	local player = game.Players.LocalPlayer 
	player.PlayerGui.Shop_GUI.Shop.Visible = false 
	player.Character.HumanoidRootPart.CFrame = CFrame.new(close.Position.X,close.Position.Y + 3,close.Position.Z) 
	player.Character.Humanoid.WalkSpeed = 16
end

open.Touched:Connect(shopMenu) 
closeButton.MouseButton1Click:Connect(closeMenu)

What was the problem?

The problem was on line 19.

You did this

player.PlayerGui.ScreenGui.Shop.Visible = false

I think it should be this

player.PlayerGui.Shop_GUI.Shop.Visible = false 

If this doesn't work then you need to screenshot your hierarchy and send it to me.

4 comments

0

This is what it says when I walk on the part btw it says this in output

0

This is what it says in output when I walk on the part "Shop_GUI is not a valid member of PlayerGui "Players.Legobuddie1.PlayerGui"

0

do you have a screen gui in startergui that is called "Shop_GUI"

0

yes

This discussion is preserved as it was. New answers, comments, and votes are closed.