You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
So If my level was 5 to 6 the Skill points would be 1500 to 1600 so the min and max would be 1500,1600
What is the issue? Include screenshots / videos if possible!
whenever I script it. it goes the min would go to 1500 to 1600
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have read every video how to make a progress bar but here
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
elseif Skill.Value == math.max(1500,1600) then
local Min,Max = 1500,1600 local SkillValue = math.clamp(Skill.Value,Min,Max)/Max
script.Parent.MainSkillPoints.Border.SkillPoints.Size = UDim2.new(SkillValue,0,1,0)
I do not understand why you would want to clamp the amount of skill points or what seems to be experience in most RPG games. It seems more intuitive to me to deduce the level of a player given the amount of skill points they have.
local function getLevel(skillPoints)
-- Implement some maths function to calculate the amount of levels one has
-- ... and round it down, so that you always get an integer.
return math.floor(skillPoints)
end
For the UI, you want to know where your skillPoints are from the perspective of your current level to the next.
local function getSkillPointsFromLevel(level)
-- The inverse of the maths function in 'getLevel' function
return level
end
local function getProgressToNextLevel(skillPoints)
local currentLevel = getLevel(skillPoints)
local skillPointsOfCurrentLevel = getSkillPoints(currentLevel)
local skillPointsOfNextLevel = getSkillPoints(currentLevel + 1)
local neededSkillPoints = skillPointsOfNextLevel - skillPointsOfCurrentLevel
-- Returns from a scale of 0 to 1 what the progress is
-- ... which you can use for your progress bar
return neededSkillPoints / (skillPoints - skillPointsOfCurrentLevel)
end
no I mean im making a progress bar without a level value levels are sorted out im trying to find out how to make it carry over without the script making it reset to 0