I am trying to make this script change the text of a sign to "Life" when you click the button for the gui
function onSelect() game.Workspace.SignA.Board.Face.Contents.Text = Life end script.Parent.MouseButton1Click:connect(onSelect)
Assuming everything else is correct:
function onSelect() game.Workspace.SignA.Board.Face.Contents.Text = "Life" -- as life is a string, it needs to be surrounded by quotation marks. Otherwise this is setting the text to whatever is contained in the variable Life, which you have not defined. end script.Parent.MouseButton1Click:connect(onSelect)
function onSelect() game.Workspace.SignA.Board.Face.Contents.Text = "Life" --Put it in quotes because it is a string. Like how you would type "print('Hello World')" and the "Hello World" is in quotes. If you do "Life" without quotes, lua would think there would be a variable named "Life". But since there isn't, It just Disconnects and in the output it would say, "Disconnected event because of exception". end script.Parent.MouseButton1Click:connect(onSelect)