PlayerAdded not working

So I have this simple script, I run it and get nothing. Output is empty no errors no warnings nothing.

game.Players.PlayerAdded:connect(function(player)
	print("Player Joined")
end)

I don’t know why this script doesn’t work.
I tried publishing the game and it still didn’t work. I don’t know how to fix this problem.

It’s a script inside of a part.

Is this a local script? charlimitssss

It’s not a local script. It’s a script inside of a part inside the workplace.

Did you make sure that the script isn’t disabled?

The script isn’t disabled. I also tried to make another script that also didn’t work.

This parameter has no purpose, try removing it and see if that works

game.Players.PlayerAdded:Connect(function()

Could you send some screenshots of where the script is located etc…

It definitely does serve a purpose as it gets the player who just joined. In this specific script, no, but theres no use removing it.

Tried to remove it, still didn’t work.

Screenshot 2022-07-04 011534

You simply only have to put the script in the workspace and type this

game.Players.PlayerAdded:Connect(function()
	if game.Players.PlayerAdded then
		print("Player Joined")
	end
end)

Add the script In ServerScriptService see if that will work.

I also have tested this and it does work

Try adding a wait() before printing.

I’m extremely confused on why your script isn’t printing anything because I’ve just tested it and it worked

Are you sure you’re looking in the right part of your output? You have the first dropdown to “All Messages” and second to “All Contexts”

@faadee (accidentally replied to the wrong person)

I don’t think that\s a necessary thing to do, the script should work without that adding the if statement, but in his case I’m kinda confused why it’s not working

Maybe it’s a bug, Maybe he could try rejoining?

But it does work because I have tested it

tried it and it didn’t work. And I need the script to stay inside of the part.

If you need to keep it in that part, try adding a Touched event