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:

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

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

Have a good weekend,
ParkCityUSA

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.