I'm trying to make a GUI button change to a certain text and change back, but it doesn't go back to the original text! (Fire Laser) There's no output errors.
tparent = script.Parent.Text function onButton1Down() if tparent == "Fire Laser" then print("trowowsers") script.Parent.Text = "Stop Firing" else script.Parent.Text = "Fire Laser" print("bowowser") end end script.Parent.MouseButton1Down:connect(onButton1Down)
Please help me!
I would recommend using MouseButton1Click instead of onButton1Down, and here is what you can do differently.
script.Parent.MouseButton1Click:connect(function() if script.Parent.Text == "Fire Laser" then print("trowowsers") script.Parent.Text = "Stop Firing" elseif script.Parent.Text = "Stop Firing" script.Parent.Text = "Fire Laser" print("bowowser") end end)
Set tparent = script.Parent, not script.Parent.Text.
This will solve your problem!
tparent = script.Parent function onButton1Down() if tparent.Text == "Fire Laser" then print("trowowsers") tparent.Text = "Stop Firing" else tparent.Text = "Fire Laser" print("bowowser") end end script.Parent.MouseButton1Down:connect(onButton1Down)