My code’s probably pretty messy since I’m pretty tired right now, but here’s the script. Sorry if it’s bad;
(player is defined)
player.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
local playerGUI = player.PlayerGui
local statsGui = playerGUI:WaitForChild("CharacterGui")
local entireFrame = statsGui:FindFirstChild("HealthBar")
local statsFrame = entireFrame:FindFirstChild("StatsFrame")
local healthBar = entireFrame:FindFirstChild("HealthFrame")
local healthText = statsFrame:FindFirstChild("Health"):FindFirstChild("HealthText")
local speedText = statsFrame:FindFirstChild("Speed"):FindFirstChild("SpeedText")
local jumpText = statsFrame:FindFirstChild("Jump"):FindFirstChild("JumpText")
oldHealth = humanoid.Health
humanoid.HealthChanged:Connect(function(newHealth)
local maxHealth = math.round(humanoid.MaxHealth)
local health = math.round(newHealth)
healthBar:TweenSize(UDim2.new(health / maxHealth, 0, 1, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Sine,0.2)
healthText.Text = health .. "/" .. maxHealth
if newHealth > oldHealth then
print("Healed")
for i = 0, 12 , 1 do
healthText.Parent.Position += UDim2.new(math.random(-1,1) / 100,0,math.random(-2,2) / 100,0)
task.wait(0.01)
healthText.Parent.Position = UDim2.new(0.049, 0,-0, 0)
end
healthText.Parent.Position = UDim2.new(0.049, 0,-0, 0)
end
if oldHealth > newHealth then
print("Took damage")
for i = 0, 12 , 1 do
entireFrame.Position += UDim2.new(math.random(-2,2) / 100,0,math.random(-2,2) / 100,0)
task.wait(0.01)
entireFrame.Position = UDim2.new(0.739, 0,0.886, 0)
end
entireFrame.Position = UDim2.new(0.763, 0,0.885, 0)
end
oldHealth = health
end)
humanoid.Changed:Connect(function(property)
if property == "WalkSpeed" then
speedText.Text = math.round(humanoid.WalkSpeed)
for i = 0, 12 , 1 do
speedText.Parent.Position += UDim2.new(math.random(-1,1) / 100,0,math.random(-2,2) / 100,0)
task.wait(0.01)
speedText.Parent.Position = UDim2.new(0.384, 0,0.052, 0)
end
speedText.Parent.Position = UDim2.new(0.384, 0,0.052, 0)
else
if property == "JumpPower" then
jumpText.Text = math.round(humanoid.JumpPower)
for i = 0, 12 , 1 do
jumpText.Parent.Position += UDim2.new(math.random(-1,1) / 100,0,math.random(-2,2) / 100,0)
task.wait(0.01)
jumpText.Parent.Position = UDim2.new(0.638, 0,0.052, 0)
end
jumpText.Parent.Position = UDim2.new(0.638, 0,0.052, 0)
end
end
end)
end
end)