You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make when you press the button it goes unvisible.
What is the issue? Include screenshots / videos if possible!
no erros, but it prints.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried like everything!
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code blocklocal
local frame = script.Parent.Parent.GameFrame
local b1 = script.Parent.Parent.GameFrame.Button1
local button = script.Parent
if button.MouseButton1Click:Connect(function()
frame.Visible = true
end)
then
end
repeat
wait(1)
until
b1.MouseButton1Click:Connect(function()
b1.Visible = true
print("prints")
end)
if statements aren’t event listeners, they only fire once. You need to bind your button.MouseButton1Click to a event then listen for when it is toggled from invisible to visible.
you arent apply a condition for it. when you say if button.MouseButton1Click or more importantly when saying if to a function you are waiting for it to become true or return a value. Since, 1 you are waiting for it to be true in until and you are defining it as a event listener and not a conditional there
As CoderHusk said if statements are not event listeners.
If you’re trying simply to have a button that makes the frame visible and a button that makes ‘Button1’ visible then this should work fine:
local frame = script.Parent.Parent.GameFrame
local b1 = script.Parent.Parent.GameFrame.Button1
local button = script.Parent
button.MouseButton1Click:Connect(function()
frame.Visible = true
end)
b1.MouseButton1Click:Connect(function()
b1.Visible = true
print("prints")
end)
Okay sorry all the original actually worked but I needed to but in invisible and i used true lol but now i put it to false and everything works thanks for evryone!