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

How do I make a GUI show when a player clicks a ClickDetector?

It's pretty simple, I just want a GUI to show to the player when they click a ClickDetector. Here's what I tried:

local Frame = game.PlayerGui.ScreenGui.Background

function onClick()


Frame.Visible = true

end

script.Parent.MouseButton1Click:connect(onClick)

1 answer

Nice try. For a ClickDetector, you need to use the MouseClick event, and from that function, you can get the actual Player.

script.Parent.MouseClick:connect(function(p) -- Make sure it leads to the ClickDetector
	p.PlayerGui.ScreenGui.Background.Visible = true
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.