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

Open close gui and change its text to close, reset once clicked?

I used

h.Visible = not h.Visible 

to make the SettingsChanger frame visible once the player clicks, if he/she clicks again it becomes invisible. However, I can't get this working properly. How can I make it so that when the player clicks it changes the text to "Close", and when he clicks again changes the text to "Settings"?

local h = script.Parent.Parent.SettingsChanger
local a = script.Parent.Parent.SettingsToggle

function click()
	a.Text = ("Close")
	h.Visible = not h.Visible 
	

end

script.Parent.MouseButton1Click:Connect(click)

1 comment

1

local h = script.Parent.Parent.SettingsChanger local a = script.Parent.Parent.SettingsToggle function click() if a.Text == "Settings" then a.Text = "Close" h.Visible = not h.Visible elseif a.Text == "Close" then a.Text = "Settings" end end script.Parent.MouseButton1Click:Connect(click) -- try this

1 answer

Thanks FakeWhatWeDontKnow for the comment above. It wasn't working properly but I edited my script using yours and it works. Appreciate it!

local h = script.Parent.Parent.SettingsChanger
local a = script.Parent.Parent.SettingsToggle

function click()
	h.Visible = not h.Visible 
	if a.Text == "Settings"  then a.Text = "Close" 
        elseif a.Text == "Close" then a.Text = "Settings"	
	end
end

script.Parent.MouseButton1Click:Connect(click)

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