Ive tried looking this up but everything i see is when a character STEPS on the brick, i just want the gui to pop up after the player clicks the block (in my case its a book).
I'll just send you the script here, make sure to look into it because I made it for you for free.
local Click = script.Parent.Click function Clicked() local plr = game.Players:FindFirstChild(game.Players.LocalPlayer.Name) plr.PlayerGui.ScreenGui.Frame.Visible = true end Click.MouseClick:connect(Clicked)
This should work, just make sure to reroute some variables so it works.
To do this, you need to place a ClickDetector
into the block itself. You can read more about those here.
Once that is added, you need to add a script under the ClickDetector
that fires whenever it is activated through a mouse click. Below is the example used by Roblox.
local clickDetector = workspace.Part.ClickDetector function onMouseClick() print("You clicked me!") end clickDetector.MouseClick:connect(onMouseClick)
Alternatively, you can replace the clickDetector
variable to just have script.Parent
. Either way, they can work but it gets kinda messy if you have multiple blocks with click detectors. That's why I'd use the script.Parent
method.
If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.