Hello, i am refining my leveling system. Now the progress bar, should not exceed (1,0,.1,0) the bolded number being what is actually moving. As you grow in power, you require more experience to level. The leveling system is in fact working, i’m just having trouble figuring how i can manipulate the horizontal vector so that no matter what the experience points being added are, it will divide evenly into the bar.
Here is the section of the code. This only deals with the GUI because the rest of the system is working like a charm. The Power Value is the Level FYI:
local constant, ExperienceScale = 1,.01
local EF = (function(Power) return constant + (Power*ExperienceScale) end)
function GUI_CONTROLLER:Progress(ProgressVal)
local Bar = player.PlayerGui:WaitForChild("Bar")
local Grimoireframe = Bar:FindFirstChild("Grimoire")
local Mysticismsframe = Bar:FindFirstChild("Mysticisms")
local ToolBarframe = Bar:FindFirstChild("Frame")
local SideButtonsframe = Bar:FindFirstChild("SideButtons")
local ProgressBar = ToolBarframe.Intelligence.Holder.Intelligence
local Progress = player.MagicValues.Progress
local Power = player.MagicValues.Power
local ProgressCap = EF(Power.Value)
local LeveledGui = player.PlayerGui:WaitForChild("LeveledUp")
if (Progress.Value >= ProgressCap) and (Power.Value <= 100) then
ProgressBar:TweenSize(UDim2.new((Progress.Value + (ProgressVal/EF(Power.Value)*1)), 0, 1, 0), "InOut", "Quad", 2)
else
ProgressBar:TweenSize(UDim2.new((Progress.Value + (ProgressVal/EF(Power.Value)*1)), 0, 1, 0), "InOut", "Quad", 2)
end
end
lets say the ProgressVal is 0.015
Lets say the power is 16. It goes through EF which makes it 1.16 and then when put through the tween size it indexes 0.015/1.16 and gets 0.0129310344827586
Thats all fine, but i need to figure out how to make it so it divides evenly into the horizontal factor of the gui, and still deliver the proportioned experience that the player gains.
Any thoughts?