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

How can I make these buttons appear and disappear every time I click on it?

local player = game.Players.LocalPlayer
local playergui = player:FindFirstChild("PlayerGui")

script.Parent.MouseButton1Click:Connect(function()
    if not playergui.WhichGive.BACKVIII.Visible then
        playergui.WhichGive.BACKVIII.Visible = true
	else
		playergui.WhichGive.BACKVIII.Visible = false
	end
end)

end)

This is the Local Script inside the TextButton. Lines 8 - 10 are the lines that should make BACKVIII disappear after clicking upon it again.

SOLVED BY Block_manvn!

1 answer

✓ Accepted answer

Make sure everything exists and are inside the right parent and make sure you double-clicked to make it disappear again. You could also use WaitForChild() just in case something hasn't loaded in yet. https://developer.roblox.com/en-us/api-reference/function/Instance/WaitForChild

Also try doing:

local player = game.Players.LocalPlayer
local playergui = player:FindFirstChild("PlayerGui")

script.Parent.MouseButton1Click:Connect(
    function()
        local bool = true
        if bool == true then
        bool = false
            playergui.WhichGive.BACKVIII.Visible = true
        else
            playergui.WhichGive.BACKVIII.Visible = false
            bool = true
        end
    end
)


1 comment

0

could u add that to the code?

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