Text Button Script Not Working?

I’ve been trying to make a button to open up a gui and make a frame visible, However it doesn’t seem to work? I’ve tried changing the function, I tried using elseif. It doesn’t seem to work

I’m fairly new to scripting, I haven’t got some of it perfected yet but I’m working on it, Heres the script I’ve been working on :


button.MouseButton1Click:Connect(function()
	if game:GetService("StarterGui").Index.IndexMenu.Visible == false then
		game:GetService("StarterGui").Index.IndexMenu.Visible = true
		game:GetService("StarterGui").Index.Text.Visible = true
	elseif game:GetService("StarterGui").Index.IndexMenu.Visible == true then
		game:GetService("StarterGui").Index.IndexMenu.Visible = false
		game:GetService("StarterGui").Index.Text.Visible = false
	end
end)

make not game:GetService(“StarterGui”).Index.IndexMenu.Visible = true, make game.Players.LocalPlayer.PlayerGui.Index.IndexMenu.Visible = true or just with script.Parent

1 Like
local button = script.Parent

button.MouseButton1Click:Connect(function()
	if script.Parent.Parent.Visible == false then
		script.Parent.Parent.Visible = true
		script.Parent.Parent.Parent.Text.Visible = true
	elseif script.Parent.Parent.Visible == true then
		script.Parent.Parent.Visible = false
		script.Parent.Parent.Parent.Text.Visible = false
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.