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
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)
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.