Help with .PlayerAdded

I am starting to develop a server-side anti-cheat. For some things, it needs to constantly check for instances in the player character. The code I currently have does not work for some reason. I have a feeling you can’t add a while loop to a PlayerAdded event.

This script is what I am currently using. The print is here to check if it actually works.

game.Players.PlayerAdded:Connect(function(plr)
	while wait(1) do
		print(plr.Name)
	end
end)

The FE god module for example must constantly check if a part is still in the player’s character.

You can add any loop inside of PlayerAdded.

Maybe the Player is not joined yet in the game so the While loop is not running yet.

When I start the test it should print my name every second. It does not do that for some reason.

Where is the script located? That might be an issue if the script doesn’t run at all.

It is located in ServerScriptService.

It works for me

Nvm I am stupid i dd not read the post

What do you mean? It is a server script.

Yea I did not read it all the way sorry about that.

1 Like

Oh. I got it to work. I just deleted the script and added it again. Was that a bug or something??

Maybe you accidentaly disabled it?

Nope it was enabled. And “Archivable” was true too… weird.