So whenever i click on the button to open the frame, it opens it but when i click it again it doesn't close, it opens on the first click but doesn't close on second click. I'm a very big noob at scripting and mostly use roblox scripting tutorials. In the code, "stuff" is the frame that needs to close. Here's the code
player = game.Players.LocalPlayer human = game.Players.LocalPlayer.Character local b = require(script.RankScript) Open = false function MouseClick() if Open == false and human.Torso.roblox.Texture == b.Owner or player.userId == 75955576 then Open = true script.Parent.Parent.Parent.Stuff.Visible = true elseif Open == true then Open = false script.Parent.Parent.Parent.Stuff.Visible = false end end script.Parent.MouseButton1Down:connect(MouseClick)
I changed script.Parent.MouseButton1Down:connect(MouseClick) to a script.Parent.MouseButton1Click:Connect(MouseClick)
local player = game.Players.LocalPlayer local human = game.Players.LocalPlayer.Character local b = require(script.RankScript) Open = false local function MouseClick() if Open == false and human.Torso.roblox.Texture == b.Owner or player.userId == 75955576 then Open = true script.Parent.Parent.Parent.Stuff.Visible = true elseif Open == true then Open = false script.Parent.Parent.Parent.Stuff.Visible = false end end script.Parent.MouseButton1Click:Connect(MouseClick)