my tweens are disobeying orders and i literally have no idea why, this is something i come across for the first time and i am unable to see any errors in my beautiful code
the BackgroundTransparency of both the frames i’ve defined just instantly pop to 1 and the tweens never play, why is this??
local TS = game:GetService("TweenService")
local tweenParameters = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out
)
-- // HEALTH UI
local plrGui = plr.PlayerGui:WaitForChild("PlayerUI"):WaitForChild("Main"):WaitForChild("UI")
local HealthAmount = plrGui:WaitForChild("HealthAmount")
local currentHealth = humanoid.Health
local LowHPUI = plr.PlayerGui:WaitForChild("PlayerUI").LowHealth
-- // STAMINA UI
local StaminaAmount = plrGui:WaitForChild("StaminaAmount")
local Stamina = plr:WaitForChild("Stamina")
local StaminaFullEffect = plr.PlayerGui:WaitForChild("PlayerUI"):WaitForChild("Stamina100")
-- // SOUNDS
local HurtSound = script:WaitForChild("DamageSound")
local LowHealth = script:FindFirstChild("LowHP")
local StaminaFullSound = plrGui.Parent:WaitForChild("StaminaFull")
function ResponsiveHealth()
if humanoid.Health < 0 then
HealthAmount.Text = "0" .. "/" .. humanoid.MaxHealth
end
if humanoid.Health > 0 then
if humanoid.Health < currentHealth then HurtSound:Play() end
if humanoid.Health < 30 then
LowHealth:Play()
HealthAmount.TextColor3 = Color3.fromRGB(125, 30, 11)
LowHPUI.Visible = true
LowHPUI.BackgroundTransparency = 0.6
else
LowHealth:Stop()
HealthAmount.TextColor3 = Color3.fromRGB(255, 255, 255)
-- // this does NOT run >:(
local HealthTween = TS:Create(LowHPUI, tweenParameters, {BackgroundTransparency = 1})
HealthTween:Play()
if HealthTween.Completed then
LowHPUI.Visible = false
HealthTween:Destroy()
end
end
HealthAmount.Text = math.floor(humanoid.Health) .. "/" .. humanoid.MaxHealth
end
currentHealth = humanoid.Health
end
function ResponsiveStamina()
StaminaAmount.Text = math.floor(Stamina.Value)
if Stamina.Value == 100 then
StaminaFullEffect.Visible = true
StaminaFullEffect.BackgroundTransparency = 0.6
-- // NEITHER DOES THIS >:(((
local StaminaTween = TS:Create(StaminaFullEffect, tweenParameters, {BackgroundTransparency = 1})
StaminaTween:Play()
StaminaFullSound:Play()
if StaminaTween.Completed then
StaminaFullEffect.Visible = false
StaminaTween:Destroy()
end
end
end
humanoid.Changed:Connect(ResponsiveHealth)
Stamina.Changed:Connect(ResponsiveStamina)