How do I make the text buttons disappear when when the mouse button clicks?
I am currently making a GUI for an upcoming game that I am making for Roblox. However, I am having difficulties making the Text, and Image buttons disappear when any of the Main Children are being clicked. The script was a load out GUI that I modified to fulfill my style of the game. So I can Understand That I may be difficult, and reside to other possibilities. Here is a sample of the script that I tried to modify: (more info at the bottom)
--{ Variables/Assignments }--
player = script.Parent.Parent.Parent
backpack = player.Backpack
--{ Functions }--
function chooseClass(class)
for i, v in pairs(backpack:GetChildren()) do v:remove() end
for i, v in pairs(class:GetChildren()) do
if v:IsA("Tool") then
v:clone().Parent = backpack
elseif v:IsA("HopperBin") then
v:clone().Parent = backpack
end
05 | script.Parent.Main.Visible = false |
06 | script.Parent.Title.Visible = false |
07 | script.Parent.Assault.Visable = false |
08 | script.Parent.Medic.Visable = false |
09 | script.Parent.Recon.Visable = false |
10 | script.Parent.Support.Visable = false |
11 | script.Parent.Shop.Visable = false |
12 | script.Parent.Money.Visable = false |
end
function onHumanoidDied(humanoid, player)
script.Parent.Main.Visible = true
script.Parent.Title.Visible = true
script.Parent.Assault.Visable = true
script.Parent.Medic.Visable = true
script.Parent.Support.Visable = true
script.Parent.Recon.Visable = true
script.Parent.Shop.Visable = true
script.Parent.Money.Visable = true
end
for i, v in pairs(script.Parent.Main:GetChildren()) do
v.MouseButton1Up:connect(function () chooseClass(v) end)
end
To put you In perspective there is a GUI labeled "StarterGUI" and Its Children Are The "Main". The main consists of 4 children being all text Buttons. "Support", "Recon", "Medic" and "Assault". Next there is an ImageButton Titled "Money". Next there are also 4 other buttons that contain many tween scripts (not important). The 5 buttons are also named "Shop", "Gadgets", "Assault", "Recon", "Support" and "Medic". Please respond soon!