-- Step 1: Get all players in the game
local players = game:GetService("Players"):GetPlayers()
-- Step 2: Iterate through each player
for _, player in ipairs(players) do
-- Step 3: Check if the player is valid
if player:IsA("Player") then
-- Step 4: Access player properties and print information
local playerName = player.Name
local playerUserId = player.UserId
local playerCharacter = player.Character
local playerHealth = playerCharacter and playerCharacter.Humanoid.Health or 0
print("Player Name:", playerName)
print("Player UserId:", playerUserId)
print("Player Health:", playerHealth)
print("----------------------")
end
end