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

Script that I believe should work doesn't!?

Asked by 5 years ago

Hello!

I've been developing a game that needs GUIs, but I've run into a problem. I've typed up this script- it doesn't pop up with errors, but when I try to run the event (click event) the function doesn't work. It's a local script inside of a text button, I'd really appreciate some help.

Here's the script:

function onClicked()
    game.StarterGui.ScreenGui2.Frame2.Visible = true
end

script.Parent.MouseButton1Click:connect(onClicked)

All the names and parents are correct. I don't know what I'm doing wrong?

1 answer

Log in to vote
0
Answered by 5 years ago

Try using :WaitForChild() instead of just trying to find them using .NameOfAssetHere.

Ad

Answer this question