I am currently making a health hi system for a game I am working on and it doesn’t work… no errors nothing and I am pretty sure my script is made right.
Local script:
local ts = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local MainUI = script.Parent
local Bar = MainUI.Bar
local TextLabel = MainUI.HealthValue
TextLabel.Text = math.floor(Humanoid.Health).. "/".. math.floor(Humanoid.MaxHealth)
Humanoid.HealthChanged:Connect(function(health)
TextLabel.Text = math.floor(health).. "/".. math.floor(Humanoid.MaxHealth)
Bar:TweenSize(UDim2.new(math.floor(health)/Humanoid.MaxHealth, 0, Bar.Size.Y.Scale, 0))
end)
local ts = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local MainUI = script.Parent
local Bar:Frame = MainUI.Bar
local TextLabel = MainUI.HealthValue
local TIME = 1
TextLabel.Text = math.floor(Humanoid.Health).. "/".. math.floor(Humanoid.MaxHealth)
Humanoid.HealthChanged:Connect(function(health)
TextLabel.Text = math.floor(health).. "/".. math.floor(Humanoid.MaxHealth)
Bar:TweenSize(UDim2.new(math.floor(health)/Humanoid.MaxHealth, 0, Bar.Size.Y.Scale, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, TIME)
end)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local MainUI = script.Parent
local Bar = MainUI.Bar
local fill = Bar.fill
local TextLabel = Bar.HealthValue
local TIME = 1
local function changehealth(health, maxhealth)
TextLabel.Text = health .. "/".. maxhealth
fill:TweenSize(UDim2.new(health / maxhealth, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, TIME)
end
changehealth(math.floor(Humanoid.Health), math.floor(Humanoid.MaxHealth))
Humanoid.HealthChanged:Connect(function(health)
changehealth(math.floor(Humanoid.Health), math.floor(Humanoid.MaxHealth))
end)
The fill size is {0, 0},{1, 0}
and healthvalue size is {1, 0},{1, 0}
healthvalue Zindex should be higher than fill’s Zindex (and make sure backgroundtransparency is 1)
In these situations, you should show what the explorer structure is, where the script it, what kind of script it is, and if you changed it, what RunContext does the script use