Rebirth open button not working

Why is my rebirth button not working this is the error it is giving


This is the line that says that there is an error

Instead you could write it like this

mainButton.MouseButton1Click:Connect(function()
    if mainFrame.Visible == false then
       mainFrame.Visible = true
    else
       mainFrame.Visible = false
    end
end)

This way when you press it should become visible if its not and not visible if it already is.

I did that it works but the first time when i click it does not open but if I press second time it opens any reason for that?

This errors because you are trying to set the frame to the opposite of its visibility, instead of setting the visibility. You should instead do

mainButton.MouseButton1Click:Connect(function()
   mainFrame.Visible = not mainFrame.Visible
end)

Also, please don’t send images of your code, write them in triple backticks as shown below:

-- ```lua

-- ```

Why don’t you provide the entire script?

mainFrame.Visible = true
mainFrame.Visible = false

This is how you toggle visibility of UI instances.

ok sure my bad, Im sorry, from next time I will send it in a lua form

1 Like

Don’t need the entire script he provided all that we need

That’s the only thing erroring, so he only showed that part of the script. Plus, mainFrame.Visible = not mainFrame.Visible also works.

Not if there are other errors present. Remember, a script stops executing once the first error occurs. There could be more further down.

But thats not their issue here

Or avoid doing that entirely by providing the entire script.

You should be more focused on helping someone fix their current problem rather than worrying about fixing all other potential problems

1 Like

Two birds one stone is an expression for a reason.

In this case there is one bird and one stone.

Not necessarily, until further information is divulged.

Unnessascary information this is a pointless discussion

Unnessascary

Stopped reading there, all I needed to see.

I could say the same for some of your own replies in this thread. Any who I believe this has been solved.

1 Like

maybe replace the else with elseif mainFrame.Visible == true then