Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What did i do wrong?

Asked by 10 years ago
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

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

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)
Ad
Log in to vote
-2
Answered by 10 years ago

yes it could

Answer this question