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.
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)