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

Why isn't my GUI disappearing and reappearing when it's told too?

So I scripted this local script in my shop GUI to pop up when you click it. (there are three parts to the shop GUI; Swords, Effects, and Coins). So that way when you click one of the (Swords, Effects, and coins) GUIs the list of items would pop up. I thought I got everything right but I was wrong.

Swords = script.Parent.Parent.Swords
Sword = script.Parent.Parent.Sword
Effects = script.Parent.Parent.Effects
Effect = script.Parent.Parent.Effect
Coins = script.Parent.Parent.Coins
Coin = script.Parent.Parent.Coin

visible = false

Swords.MouseButton1Down:Connect(function()
 if visible == false then
  Sword.Visible = true
  visible = true


end
Effect.Visible = false  -- these two lines of code tell the other guis to close when this gui is opened
Coin.Visible = false
end)

When I press the button the gui will pop up and the others disappeared but after clicking it multiple times it wouldn't work. (BTW I am new to scripting so thanks.) I put this local script in every button but I just changed the Coins and Swords and effects. Thank you! If you need more details I'll give more details.

When I press the button the gui will pop up and the others disappeared but after clicking it multiple times it wouldn't work.

Link to a video with more details: (http://drive.google.com/file/d/1PnznmaG1j_8U8jIJpnJ_WcaZrOME-Oay/view?usp=sharing[])

3 comments

0

So judging from the video, you want to toggle the visibility of each gui?

0

Also, is this the full script for the guis or is there more than this?

0

Yes there is only one script for the Coin, Sword, or Effect button but, there is the same local script in the button. However, I changed lines 10, 17, and 18 to fit that button.

1 answer

✓ Accepted answer

You've forgotten to turn the visible thing off again if it's pressed when it's showed. This should work:

Swords = script.Parent.Parent.Swords
Sword = script.Parent.Parent.Sword
Effects = script.Parent.Parent.Effects
Effect = script.Parent.Parent.Effect
Coins = script.Parent.Parent.Coins
Coin = script.Parent.Parent.Coin

visible = false

Swords.MouseButton1Down:Connect(function()
 if visible == false then
  Sword.Visible = true
  visible = true


end
Effect.Visible = false  -- these two lines of code tell the other guis to close when this gui is opened
Coin.Visible = false
visible=false
end)

cheers!

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