Correct me if I’m wrong, but I think I used the same method as a different script I have which shows the player height in a ui
local Player = game:GetService("Players").LocalPlayer
local Frame = script.Parent
local HealthBack = Frame:WaitForChild("HealthBack")
local Health = HealthBack:WaitForChild("Health")
local SizeBack = Frame:WaitForChild("SizeBack")
local Size = SizeBack:WaitForChild("Size")
local SizeLabel = SizeBack:WaitForChild("Label")
local TS = game:GetService("TweenService")
local Market = game:GetService("MarketplaceService")
local MaxHeight = 40
function Setup()
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Height = Character:WaitForChild("Height")
if Market:UserOwnsGamePassAsync(Player.UserId, 9228818) then
MaxHeight = 65
end
if Humanoid then
local function Update()
if Humanoid.Health <= 25 then
TS:Create(Health, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundColor3 = Color3.fromRGB(255, 0, 0)}):Play()
elseif Humanoid.Health <= 50 then
TS:Create(Health, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundColor3 = Color3.fromRGB(182, 170, 0)}):Play()
elseif Humanoid.Health > 50 then
TS:Create(Health, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundColor3 = Color3.fromRGB(41, 117, 0)}):Play()
end
Health.Text = string.format("%s/%s", tostring(math.floor(Humanoid.Health)), tostring(Humanoid.MaxHealth))
Health:TweenSize(UDim2.new((Humanoid.Health / Humanoid.MaxHealth) * 0.95, 0, Health.Size.Y.Scale, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1, true)
end
Humanoid:GetPropertyChangedSignal("Health"):Connect(Update)
Humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(Update)
Update()
end
if Height then
local function Update()
SizeLabel.Text = string.format("Size (%s)", tostring(Height.Value))
if Height.Value < 0 or Height.Value > MaxHeight then
return
end
Size:TweenSize(UDim2.new((Height.Value / MaxHeight) * 0.95, 0, Size.Size.Y.Scale, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1, true)
end
Height:GetPropertyChangedSignal("Value"):Connect(Update)
Update()
end
end
Player.CharacterAdded:Connect(Setup)
Setup()
Does this work a different way?