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

How Do You Make A GUI Visible When Clicking An Object That Is In The Workspace?

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?

2 answers

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.