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?
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! ;)