How to get player on mousebutton1click

Replace the server script with a local script and use this:

local button = script.Parent -- Defines the button

button.MouseButton1Click:Connect(function() -- Detects button press
	button.Parent.Parent.Enabled = false -- Disables the ScreenGui entirely
end)
1 Like

What you are trying to do is pretty easy, you can put a LocalScript inside the button and use a variable like “opened” something like:

local gui = script.Parent 
local frame = --Path to your frame
local opened = false

gui.MouseButton1Click:Connect(function()
if opened == false then
opened = true
frame.Visible = true
else
opened = false
frame.Visible = false
end)

I think that would work

Oh, you said close, but still, the script I said would work for open/close, but if you want to be a close-only button, that would work too.

You cant have clients interacting with each other directly

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.