About The Health Bar
Its a little gui that show the player health and only client “Player” can see it and its animated using TweenService
Setting Up The Health Bar
The Size and the Position of the Frame in the red border Should Be Like this:
Enable The Reset on Spawn Property in the Health Gui
The Script
Put the script in the local script
local TW = game:GetService("TweenService")--Get Tween Service
local Player = game:GetService("Players").LocalPlayer --Get The Player
local Character = Player.Character or Player.CharacterAdded:Wait() --Wait For The Player Humanoid
local Humanoid = Character:WaitForChild("Humanoid") --Get The Player Humanoid
local Healthbar = script.Parent -- Get The Health Bar
local function UpdateHealthbar() --Health Bar Size Change Function
local health = math.clamp(Humanoid.Health / Humanoid.MaxHealth, 0, 1) --Maths
local info = TweenInfo.new(Humanoid.Health / Humanoid.MaxHealth,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --Tween Info
TW:Create(script.Parent,info,{Size = UDim2.fromScale(health, 1)}):Play() -- Create The Tween Then Play It
end
UpdateHealthbar()--Update The Health Bar
Humanoid:GetPropertyChangedSignal("Health"):Connect(UpdateHealthbar) --Update The Health Bar When The Health Change
Humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(UpdateHealthbar) --Update The Health Bar Wheb The MaxHealth Change
Shout out to this guy csqrl for the script he posted in the Last Tutorial