Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Button disappearing when commanded to close and reappear?

Asked by
harstud 218 Moderation Voter
5 years ago

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.

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. RiskoZoSlovenska 378 — 5y
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 cegberry 432 — 5y
0
Use the PlayerGui in both of your scripts. DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
 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.

0
^^ Yes that's basically what I said in dat comment :c RiskoZoSlovenska 378 — 5y
0
Didn't work. harstud 218 — 5y
Ad

Answer this question