Hello, so i have this code and it just worked fine, but now, it is just giving me much task.delay warning, take a look, also it gives the warning at line 30.
--
local HealthBar = script.Parent.HealthBar
local PlayerService = game:GetService("Players")
--
local TweenService = game:GetService("TweenService")
local TweenInformation = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out,0,false,0)
local CharacterHealthLabel = script.Parent.CharacterHealth
--
local LastHealth = 0
--
while task.wait() do
if PlayerService.LocalPlayer.Character then
local Humanoid = PlayerService.LocalPlayer.Character:WaitForChild("Humanoid")
local CurrentHealth = Humanoid.Health
local NewFrameSize = UDim2.new(CurrentHealth / 100,0,1,0)
local Tween = TweenService:Create(HealthBar, TweenInformation, {Size = NewFrameSize})
Tween:Play()
if CurrentHealth > LastHealth then
for I = LastHealth, CurrentHealth, 1 do
script.Parent.CharacterHealth.Text = (tostring(math.floor(I)).." %")
task.wait(0.256/CurrentHealth - LastHealth)
end
else
for I = LastHealth, CurrentHealth, -1 do
script.Parent.CharacterHealth.Text = (tostring(math.floor(I)).." %")
task.wait(0.256/(CurrentHealth - LastHealth)) --Here is line 30.
end
end
LastHealth = CurrentHealth
end
end
--