Hello, I have a game that multiplies the amount of kills that you get by 100, which is your XP score. So when the match ends, the user gets awarded XP based on the amount of kills they have, and it works. However I also have the level bar play a little animation as it gives you the XP earned by one, but it takes forever to finish, especially if one got a lot of kills. How can I make this animation be faster? I think I am doing it wrong but I am not a professional coder and I used this method as it was the most easiest one that I could code. Here is my code:
local reward = cash
local rewardxp = xp
leaderstats.Cash.Value = leaderstats.Cash.Value + reward
local total = leveling.Current.Value + rewardxp
print(total)
repeat tracker = tracker + 1 leveling.Current.Value = leveling.Current.Value + 1 wait(0.00001) until tracker == total
end
I could increase the increment value but if the increment value is not a multiple of the total, the loop will repeat forever, giving the player a lot more XP than needed.

2 comments
try doing wait() instead of wait(0.00001), maybe that can help?
didnt work