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:
local level = game:GetService("DataStoreService"):GetDataStore("DiscWarsLevels") local xp = game:GetService("DataStoreService"):GetDataStore("DiscWarsXP") local axp = game:GetService("DataStoreService"):GetDataStore("DiscWarsAmountXP") function savedata(dataname, playerid, value) game:GetService("DataStoreService"):GetDataStore(dataname):SetAsync(playerid, value) end game.Players.PlayerAdded:connect(function(player) local leader = Instance.new("Folder") leader.Name = "leaderstats" leader.Parent = player local levels = Instance.new("IntValue") levels.Value = level:GetAsync(tostring(player.userId)) or 1 levels.Name = "Level" levels.Parent = player:WaitForChild("leaderstats") local xps = Instance.new("NumberValue") xps.Value = xp:GetAsync(tostring(player.userId)) xps.Name = "XP" xps.Parent = player local xpn = Instance.new("IntValue") xpn.Value = axp:GetAsync(tostring(player.userId)) or 700 xpn.Name = "XPNeeded" xpn.Parent = player xps.Changed:connect(function() if player:WaitForChild("XP").Value >= player:WaitForChild("XPNeeded").Value then levels.Value = levels.Value + 1 xpn.Value = xpn.Value + 700 savedata("DiscWarsLevels", player.userId, levels.Value) savedata("DiscWarsXP", player.userId, xps.Value) savedata("DiscWarsAmountXP", player.userId, xpn.Value) else savedata("DiscWarsLevels", player.userId, levels.Value) savedata("DiscWarsXP", player.userId, xps.Value) savedata("DiscWarsAmountXP", player.userId, xpn.Value) end savedata("DiscWarsLevels", player.userId, levels.Value) savedata("DiscWarsXP", player.userId, xps.Value) savedata("DiscWarsAmountXP", player.userId, xpn.Value) end) end) game.Players.PlayerRemoving:connect(function(player) savedata("DiscWarsLevels", player.userId, player.leaderstats.Value) savedata("DiscWarsXP", player.userId, player.XP.Value) savedata("DiscWarsAmountXP", player.userId, player.XPNeeded.Value) end)