PlayerAdded won't trigger

game.Players.PlayerAdded:Connect(function(Player)
	game:GetService("ReplicatedStorage").Products:FireAllClients(Player, products)
	game.ReplicatedStorage.Setup:FireAllClients(Player, GroupId)
	print("fired events")
end)

No error but fired events does not log! That means PlayerAdded won’t trigger since there’s no errors about the events

This is a Server script in ServerScriptService

sometimes studio is bugged you may have to test it in the game its self.

I think you having a simple mistake
instead of using :
game.Players.PlayerAdded:Connect(function(Player)
u need to use this:
local Players = game:GetService(“Players”)
Players.PlayerAdded:Connect(function(Player)

So I have to test everything in game now?

only till its working in studio again. usually, you can just try restarting studio and see if that works.

FireAllClients doesn’t need the player argument as it fires the remote event to every client that is listening to it. Just put in your other arguments:

game:GetService(ReplicatedStorage).Products:FireAllClients(products)
game.ReplicatedStorage.Setup:FireAllClients(GroupId)

This is wrong. You can use game.Players.PlayerAdded or game:GetService(“Players”).PlayerAdded as they both work. (unless you changed the name of the “Players” service)

Sometimes the player already exists before this event gets the chance to fire. You should loop through all players, and trigger the same function that you have connected to the PlayerAdded event.

local Players = game:GetService("Players")

local function onPlayerAdded(player) 
  print(player.Name)
end

Players.PlayerAdded:Connect(onPlayerAdded)

for _,player in ipairs(Players:GetPlayers()) do
  onPlayerAdded(player)
end
1 Like

This too. If you only want it for that one player you can use:

game:GetService(ReplicatedStorage).Products:FireClient(Player, products)
game.ReplicatedStorage.Setup:FireClient(Player, GroupId)
1 Like

I fixed it by instead of using PlayerAdded, I just fired all clients not inside of Player Added