Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I have a Leveling System, but I can't skip over levels. How do I change it so I can do that?

Asked by 6 years ago

Currently, the leveling system that I have works. Although I'm not entirely for sure how I would change it to make it a little bit more random instead of leveling up every 700 xp (which is also a problem I need solved, if possible.), I would like to know what I should add so then I can skip levels.

For example, if I put into my values 1400 and my current XP is 0, it tells me that my level is 2, but instead it should be 3. Here is the code:

01local level = game:GetService("DataStoreService"):GetDataStore("DiscWarsLevels")
02local xp = game:GetService("DataStoreService"):GetDataStore("DiscWarsXP")
03local axp = game:GetService("DataStoreService"):GetDataStore("DiscWarsAmountXP")
04 
05function savedata(dataname, playerid, value)
06    game:GetService("DataStoreService"):GetDataStore(dataname):SetAsync(playerid, value)
07end
08 
09game.Players.PlayerAdded:connect(function(player)
10 
11    local leader = Instance.new("Folder")
12    leader.Name = "leaderstats"
13    leader.Parent = player
14 
15    local levels = Instance.new("IntValue")
View all 52 lines...
0
Rather than having separate "XP" and "XP needed" counters, just have one. Work out what their level is from their current XP amount. E.g., in this case, just make it so their level is `1 + xp / 700`. fredfishy 833 — 6y

Answer this question