What should I use to activate a script when a player joins?

I wanted to know this when making my game. I want it so that when a player joins, it activates a script. Here is my script:

DialogueText.Text = "You: Who are you?"
DialogueText.Text = "Hermit: My name is not important. You must take this sword."
DialogueText.Text = "You: What's it for?"
DialogueText.Text = "Hermit: You must defeat Xethoth, the Ultimate Destroyer!"
DialogueText.Text = "You: Will it be hard?"
DialogueText.Text = "Hermit: Almost impossible."
DialogueText.Text = "You: Wait, hold on–"
DialogueText.Text = "Hermit: Goodbye!"
DialogueText.Text = "You: Really?"
DialogueText.TextSize = 23
DialogueText.Text = "SUBTERRAINIA"

Could you help me? I’m using a localscript BTW.

Have a good weekend,

If this is a LocalScript, you can put it in StarterPlayerScripts (under StarterPlayer). Code in that container automatically executes after the client loads into the game and client-side elements are an appropriate fit for there.

Ok. But It’s a gui script, and I don’t think it would run correctly in StarterPlayerScripts.

LocalScripts in Guis will also run after Guis from StarterGui are added to the player, so it’s appropriate to leave the script in the Gui and it will still run.

I don’t feel like I have the full circumstances of what you want to do here. Could you provide more information and why you’d need to check when a player joins? Client doesn’t need to do that. What does your explorer look like, or is there any other code relevant to this problem?

So I’m trying to make it a conversation between two people. I’m using a Textlabel with a localscript in it, which is the one we’re talking about. I want to make the script run when a player joins.

do what lesser suggested
just have it enabled in the gui, itll run when the gui loads.