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

Button disappearing when commanded to close and reappear?

Link to video to show the bug. I don't know why this happens, but it's weird. Here's the script.

script.Parent.MouseButton1Down:Connect(function(hit)

script.Parent.Parent.Parent.Enabled = false

game.StarterGui.Inventory.ImageButton.Visible = true

end) Everything is fine except the button.

The script for the button to open the inventory.

script.Parent.MouseButton1Down:Connect(function(hit)

script.Parent.Visible = false

script.Parent.Parent.Parent.ScreenGui.Enabled = true

end) I don't know if it's the rotate script causing the problem. But it's strange.

3 comments

0

I think your problem is that you are changing the button stored in StarterGui and not in PlayerGui. Try that. From what I recall, StarterGui is like the ServerStorage for GUIs that get distributed to players, so changing it would change it for all players that join the game/respawn.

0

Basically your telling the ScreenGui to be disabled, which disables all of the descendants of ScreenGui, making them unviewable, and un-interactive, you may want to use .Visible instead of .Enabled

0

Use the PlayerGui in both of your scripts.

1 answer

✓ Accepted answer
 script.Parent.MouseButton1Down:Connect(function(hit)
 script.Parent.Parent.Parent.Enabled = false
 game.Players.LocalPlayer.PlayerGui.Inventory.ImageButton.Visible = true
 end)  
 
script.Parent.MouseButton1Down:Connect(function(hit)
script.Parent.Visible = false
 script.Parent.Parent.Parent.ScreenGui.Enabled = true
 end)

You must use "game.Players.LocalPlayer.PlayerGui" in order to change things of a GUI. StarterGUI clones the children inside the joining player's PlayerGUI, not view it.

2 comments

0

^^ Yes that's basically what I said in dat comment :c

0

Didn't work.

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