Sometimes Players.PlayerAdded doesn't work in studio test

Sometimes in studio test script doesn’t detect player joins doesn’t create instances for player

Is it normal in studio? or just a bug? Usually it works! like i said it happens “sometimes”

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
        warn(Player)

        local leaderstats = Instance.new("Folder", LocalPlayer)
	leaderstats.Name = "leaderstats"
end)

I’ve experienced this. The player probably gets added too fast for the script to load, so my workaround would be to add for i, v in Players:GetPlayers() do your_code end to the beginning of the script. If you want to try to avoid having to do this, try moving the script to a different container, such as ServerScriptService.

1 Like