Hi developers:
So I’m having trouble with my code that makes a Frame disappear when a TextButton is clicked. At the start of the game, it’s invisible. When a player clicks on the button that “starts” the game, the Frame reappears. However, when I click the TextButton within that Frame, the following code (located in the TextButton) won’t work to make the Frame disappear when the TextButton is clicked:
script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent.Visible = false -- Makes the frame disappear
end)
That was the code that isn’t working. The full code in the script is:
script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent.Visible = false -- Makes the frame disappear
end)
-- This next part is just assigning a billboard GUI to the player's head when the button is clicked
local gamedesignertitle = game.ServerStorage.GameDesigner -- This is the billboard GUI
script.Parent.MouseButton1Down:Connect(function()
gamedesignertitle:Clone().Parent = script:FindFirstAncestorOfClass("Player").Character.Head
end)
I have 11 TextButtons within the Frame with a similar purpose. Each is supposed to, when clicked, assign a specific billboard GUI to the player’s head and close the Frame (make it invisible).
Any ideas as to what is wrong? (The code is located in a server script and not a LocalScript because I needed to access ServerStorage
for the Billboard GUIs)