Hey, so I am trying to display how much energy is needed on a ui bar in order for the user to use the ability.
This is what happens so far:
https://gyazo.com/5b5becb50e20bdcf336e197a092ec7b7
https://gyazo.com/e32437f60563b5de7f5e19a5803bcb48
The problem is that, the red bar gets shorter and shorter and doesn’t remain a constant accurate value that the player needs, so I came to the conclusion that I scripted this wrongly and need assistance.
local ReqEnergy = (25 - myCurrentEnergy ) --25 Is required amount, and myCurrentEnergy is how much i have
local Required = 25 --How much energy user needs to use ability
local StaminaImage = ScreenGui.Cooldowns[Arg3]:Clone()
StaminaImage.Parent = ScreenGui.Cooldowns
StaminaImage.BackgroundColor3 = Color3.fromRGB(255,0,0)
StaminaImage.Name = "Redunderlayer"
local Formula = (ReqEnergy/Required)
TweenService:Create(StaminaImage, TweenInfo.new(0.7, Enum.EasingStyle.Quad), {BackgroundTransparency = 1}):Play()
Debris:AddItem(StaminaImage, 0.75)
What I am trying to achieve:
-Is to display on the red bar accurately, the amount of energy the user needs.