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

What did i do wrong?

function onClick()--function
	script.Parent.CloseButton:Destroy()--destroys text button
	wait(.5)
	Instance.new('TextButton',game.StarterGui.TestGui.Frame) --makes new button
	TextButton.Name = "Taco" --renames it
	
end

script.Parent.CloseButton.Clicked:connect(onClick) --I tried using MouseButton1Down

Could i use the "MouseButton1Click"? (my first gui things)

2 answers

Well, I'm guessing you want the Text to say Tacos, not the name. Also, if you destroy the button the script is in, the script stops and goes with it.

tb = script.Parent -- The TextButton
on = false

tb.MouseButton1Click:connect(function()
	if on == false then
		tb.Text = "Tacos"
		on = true
	else
		tb.Text = "Not Tacos"
		on = false
	end
end)

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