Okay, so I have a LocalScript that gets cloned into the Player's PlayerGui when they click a button. As soon as it is copied into the PlayerGui, I want it to immediatly start running the first function in it. But I don't know how to get it to do that? If I just call the function first thing, it doesn't work because the function is underneath in the script.
Does anyone know how I would get around this problem? Is there some event that can detect when a LocalScript is placed in a Player? Or any other Event that could help me in this situation?
Thanks in advance.
I figured it out. In the script that cloned the the LocalScript into the PlayerGui I had it wait and the change the name of an object. In the LocalScript I used the Changed event to listen for the object to be changed and then Connected to the function.
Anyway I solved that problem but now it's causing the function to run twice for some reason. Thanks for all the help guys!