✓ Accepted answer
The link you sent is outdated so I made this from my own head:
Use a Local Script and insert it to StarterGui.
Insert you ScreenGui to the Part's ClickDetector
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local part = workspace:WaitForChild("Part")
local cd = part:FindFirstChild("ClickDetector")
local gui = cd:FindFirstChild("ScreenGui")
cd.MouseClick:Connect(function()
if not playerGui:FindFirstChild(gui.Name) then
gui:Clone().Parent = playerGui
elseif playerGui:FindFirstChild(gui.Name) then
playerGui:FindFirstChild(gui.Name):Destroy()
end
end)
Now when you click the part, it opens the gui and when you click the part again it closes it.
2 comments
can't use findfirstchild("playergui") on serverscripts, you can only do thing.Parent = player.PlayerGui (yes it works I tested it)
o no!