I have made a script that display the height (Y Position of the player's torso) but it's only working for 1 player and I don't understand why
Here is the script :
local function OnPlayerJoin(player)
repeat wait() until player.Character
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Height = Instance.new("IntValue")
Height.Name = "Height"
Height.Parent = leaderstats
while true do
for i, player in pairs(game.Players:GetPlayers()) do
local char = player.Character
if char:FindFirstChild("HumanoidRootPart") then
Height.Value = (player.Character.HumanoidRootPart.Position.Y - 8)
end
end
wait()
end
end
game.Players.PlayerAdded:Connect(OnPlayerJoin)
The script is in ServerScriptService and it's a normal script
Thank you in advance !

2 comments
PlayerAdded passes one player argument at a time.
What can I do instead of PlayerAdded? @MCAndRobloxUnited