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 !
I have experimented a bit and I figured out that when I'm playing it display my height until I fall in the void, at this moment my height is the height of another player in the game (and his value is 0).
It's probably an issue with the part of the script where it search for HumanoidRootPart
, the script take only the first value he can find.
I don't know how to fix that.
Maybe with a LocalScript
?