I'm trying to figure out how to make a GUI turn visible when an object in the workspace is clicked. Is there a way to do so?
COMMUNITY QUESTION
How Do You Make A GUI Visible When Clicking An Object That Is In The Workspace?
2 answers
Place this in a part with a ClickDetector
script.Parent.ClickDetector.MouseClick:connect(function(player)
Sg = player.PlayerGui:WaitForChild("ScreenGui") --Gui name
Sg.Enabled = true
end)
So you are wanting this.
local ClickDetector = script.Parent:FindFirstChild("ClickDetector")
-- Place a 'ClickDetector' in your part!
ClickDetector.MouseClick:Connect(function(click)
if click.Parent:FindFirstChild("Humanoid") then
local char = click.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local gui = player.PlayerGui:FindFirstChild("NameOfGUI") -- Enter your GUI name here!
gui.Enabled = true
end
end)
U have to put this script in Part next to the ClickDetector! If script dont work message me! Feel free to accept my answer if I helped you! ;)
1 comment
0
The MouseClick event returns the player, not the part...
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Can’t modify the PlayerGui from the server.
I just ran this and it worked
https://www.roblox.com/games/1613996984/The-Pr0fessors-Place