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

Can someone help me with this ScreenGui?

I am trying to make a ScreenGui that changes text when clicked, as part of the ROBLOX tutotials. This is what I have on my local script, which is in StarterGui along with my ScreenGui.

function game.StarterGui.ScreenGui.TextButon.MouseButtonClick:connect()
	game.StarterGui.ScreenGui.TextButton.Text = "I've been clicked!"
end

When I try it out it doesn't work, I've seen a different function format lately so it might be an outdated tutorial.

1 answer

Functions take the form of,

function nameOfFunction(parameters)
	--code
end

A function can therefore be connected to an event with the connect method;

function nameOfFunction(parameters)
	--code
end
pathToEvent:connect(nameOfFunction)

Or, if you would like to use an anonymous function,

pathToEvent:connect(function(parameters)
	--code
end)

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