game.Players.PlayerAdded not working for the Player that joined the game

Hi,

I’m currently making a system that detects if a friend has joined the game. I used game.Players.PlayerAdded as a way to detect it, but it only detects for the person already in the server, not for the one that joined the server. The script is in ServerScriptService, and I recall that game.Players.PlayerAdded function could work for the Player that was added to the game. Could someone help?

can you show the part of the script that handles this?

Here is a screenshot

image_2025-02-21_224813582

If you want it to also affect the player who just joined, I would suggest you duplicate the line starting with plr:FindFirstChild("PlayerBoosts"), and replace plr with player in the duplicate.

(Maybe use WaitForChild instead of FindFirstChild though)

i.e.

game.Players.PlayerAdded:Connect(function(player)
	for _, plr in game.Players:GetPlayers() do
		plr.PlayerBoosts.FriendBoost.Value += 0.1
		player:WaitForChild("PlayerBoosts").FriendBoost.Value += 0.1
	end
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.