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

Can someone help me with this ScreenGui?

Asked by
Carvyy 15
9 years ago

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

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

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

Answer this question