The problem is that the progress bars for the other abilities won't work at all anymore. The one for the special ability works only the first time, but it doesn't reset, and the other ones don't work at all. I literally don't even know what I'm doing wrong. I checked the API references, play-tested a bunch of times, etc. Nothing's worked. I'm not even sure how I should debug this either. What is going on here?
local screenGui = script.Parent.Parent
local player = game:GetService("Players").LocalPlayer
local Events = game:GetService("ReplicatedStorage").RemoteEventsAndFunctions
local SetHUDProgressBar = Events.SetHUDProgressBar
local SpecialAbilityReady = Events.Abilities.SpecialAbilityReady
workspace:WaitForChild(player.Name)
local character = player.Character
local ability1ProgressBar = script.Parent.Ability1.Progress
local ability2ProgressBar = script.Parent.Ability2.Progress
local ability3ProgressBar = script.Parent.Ability3.Progress
local specialAbilityProgressBar = script.Parent.Parent.SpecialAbility.Progress
local progressBars = {ability1ProgressBar, ability2ProgressBar, ability3ProgressBar, specialAbilityProgressBar}
SetHUDProgressBar.OnClientEvent:Connect(function(abilityIndex, progress, animateToProgress, animTime)
local clampedProgress = math.clamp(progress, 0, 1)
if abilityIndex == 4 then
progressBars[abilityIndex].Parent.Label.Text = math.floor((clampedProgress * 100) + 0.5).."%"
else
progressBars[abilityIndex].Parent.TextColor3 = Color3.new(0.290196, 0.290196, 0.290196)
end
local function callback(didComplete)
if didComplete then
if abilityIndex ~= 4 then
progressBars[abilityIndex].Parent.TextColor3 = Color3.new(1, 1, 1)
else
progressBars[abilityIndex].Parent.BackgroundColor = Color3.new(0.129412, 0.129412, 0.129412)
end
end
end
if animateToProgress == true then
if abilityIndex == 4 then
if specialAbilityProgressBar.BackgroundTransparency == 1 then
specialAbilityProgressBar.BackgroundTransparency = 0.25
end
specialAbilityProgressBar.Parent.BackgroundColor3 = Color3.new(0.129412, 0.129412, 0.129412)
end
specialAbilityProgressBar:TweenSize(UDim2.new(1,0,clampedProgress,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, animTime, true, callback)
elseif animateToProgress == false then
progressBars[abilityIndex].Size = UDim2.new(1,0,clampedProgress,0)
end
end)
SpecialAbilityReady.OnClientEvent:Connect(function(abilityName, backgroundColor)
local specialAbilityFrame = specialAbilityProgressBar.Parent
specialAbilityProgressBar.BackgroundTransparency = 1
specialAbilityFrame.Label.Text = abilityName
specialAbilityFrame.BackgroundColor3 = backgroundColor
end)

1 comment
It just won't tween. It'll set the size, it'll even have the callback function fire after, but it won't tween at all