How to create a level & prestige system? (Solved)

Yes, I know there’s plenty of tutorials on YouTube and dev forum for making level systems, but those are for basic systems. I’m looking to make a more advanced system.

So I want to make a level system where players get 100 xp per kill and it takes 1000 xp to level up. Eventually when players reach level 100 I want a process I call “Prestige” to happen. When a player prestiges their level resets, they’ve unlocked that Prestige rank, and it now takes double the xp to level up.

EXAMPLE: Little Timmy just reached level 100 for the first time, his level is reset and he unlocks Prestige Rank 1. His level is now reset to 0 and instead of 1000 xp per level it’s now 2000 xp.

Now to give clarity on the purpose of prestige -
Ingame there is going to be a rewards shop called “Prestige”. In this shop a player’s current level with an xp bar is displayed along with their prestige rank. So what are Prestige ranks for you ask? Right below everything I just mentioned will be a list of rewards that are Prestige rank locked.

EXAMPLE: Little Timmy is now Prestige 1, the prestige 1 reward is now available to claim in the prestige section of the rewards shop. Prestige rewards 2-10 are locked and can’t be claimed.

Then when a player hits Prestige 10 (aka level 1000) they no longer prestige when hitting level 100 and just continue on getting an infinite amount of levels for Prestige 10.

How would I approach creating a system like this? Any advice or suggestions would be appreciated!

1 Like

I suggest using tables in server, and load the datastore and populate the Levels table in server.

Then when player does a kill, increase the XP in player’s table (Im using a ClickDetector in this example). If on Kill after giving the 100xp, if player total xp is 1000 then increase the prestige level in player’s table and restart xp to 0.

And when player goes to shop, check the prestige level of player’s table to allow or not to get the reward

An example could be this:

-- Table holding the Levels of players in game
local Levels = {}

-- Rewards based on prestige
local PrestigeRewards = {
	[1] = {Name = "waka", Data = {} },
	[2] = {Name = "mole", Data = {} },
}

local BaseXP = 1000

-- Give XP and check if prestige can grow on Kill
game.Workspace:WaitForChild("GetXP"):WaitForChild("ClickDetector").MouseClick:Connect(function(ply)
	Levels[ply.UserId]["XP"] += 100
	
	if Levels[ply.UserId]["XP"] == BaseXP * Levels[ply.UserId]["Prestige"] then
		Levels[ply.UserId]["Prestige"] += 1 -- Increase Prestige
		Levels[ply.UserId]["XP"] = 0 -- Restart XP
	end
end)

-- Shop claim prestige reward
game.Workspace:WaitForChild("ClaimReward"):WaitForChild("ClickDetector").MouseClick:Connect(function(ply)
	-- Check whats the rewards cheking current player's prestige	
	warn("you are allowed to claim this prestige reward:")
	print(PrestigeRewards[Levels[ply.UserId]["Prestige"]]["Name"])
	
	-- or check the reward player is asking:
	if 5 < Levels[ply.UserId]["Prestige"] then -- check if reward level 5 is lower than player's current prestige
		warn("You are allowed to claim reward 5")
	end
end)

-- Read the datastore on join to populate Levels table
game.Players.PlayerAdded:Connect(function(ply)
	-- Read datastore and populate Levels table
	
	-- If no data, give starter values:
	Levels[ply.UserId] = {XP = 0, Prestige = 1}
	
end)

-- Save datastore of the player's progress in session
game.Players.PlayerRemoving:Connect(function(ply)
	-- Save datastore
	-- Flush data from server
	Levels[ply.UserId] = nil
end)
1 Like

Once again you’ve come in clutch, thanks dude!

1 Like

Actually I think I can explain this a bit better.

  • So players get 100 XP every kill
  • It takes 1000 XP to Level Up (So 10 kills)
  • Every 100 levels a player prestiges (kinda like a mega level of sorts)
  • When a player reaches a prestige it resets their level, requires them to need double the amount of xp for each level (Prestige 1 = 2000 xp per level, Prestige 2 = 3000 xp per level, and so on).
  • When a player unlocks a certain prestige (mega level) they get access to a reward that was previously locked to that prestige.
  • When a player reaches max Prestige (Prestige 10) they no longer have the 100 level cap that resets everything and gives a new rank, they’ll simply gain levels infinitely beyond this point

EDIT: Imagine MM2’s leveling system just modified. Prestige | Murder Mystery 2 Wiki | Fandom So instead of Prestiges being purely cosmetic it grants access to rewards for that Prestige. And instead of simply just resetting player’s level it also doubles the required xp

Correct me if I’m wrong since chances are I probably am. Is this script prestiging them every 1000 xp? If so that’s not the case. Every kill is 100 xp, every 1000 is a level, every 100 levels is a prestige

Yeah, just edit it a little, its just embed more values into the check, adding level value in players table is enough.

With this slight change it will be 100 xp per kill, 1000xp per level, 100 levels per prestige level, and when prestige is level 2, required xp per level is 2000xp, and so on with next levels.

local XPperKill = 100
local BaseXP = 1000
local LevelsInPrestige = 3

-- Table holding the Levels of players in game
local Levels = {}

-- Rewards based on prestige
local PrestigeRewards = {
	[1] = {Name = "waka", Data = {} },
	[2] = {Name = "mole", Data = {} },
	-- add more
}

-- Give XP and check if prestige can grow on Kill
game.Workspace:WaitForChild("GetXP"):WaitForChild("ClickDetector").MouseClick:Connect(function(ply)
	
	Levels[ply.UserId]["XP"] += XPperKill
	warn(Levels[ply.UserId]["XP"])
	if Levels[ply.UserId]["XP"] == BaseXP * Levels[ply.UserId]["Prestige"] then
		print(Levels[ply.UserId]["XP"])
		Levels[ply.UserId]["Level"] += 1  
		Levels[ply.UserId]["XP"] = 0
		print(Levels[ply.UserId]["Level"])
		
		if Levels[ply.UserId]["Level"] == LevelsInPrestige then
			print(Levels[ply.UserId]["XP"])
			Levels[ply.UserId]["Prestige"] += 1
			Levels[ply.UserId]["Level"] = 0
			print(Levels[ply.UserId]["Prestige"])
		end
	end
	
end)

-- Shop claim prestige reward
game.Workspace:WaitForChild("ClaimReward"):WaitForChild("ClickDetector").MouseClick:Connect(function(ply)
	warn("current prestige:", Levels[ply.UserId]["Prestige"]-1)
	-- check the reward player is asking:
	if 1 < Levels[ply.UserId]["Prestige"] then -- check if reward level 1 is lower than player's current prestige
		warn("You are allowed to claim reward:")
		print(PrestigeRewards[1]["Name"])
	end
end)

-- Read the datastore on join to populate Levels table
game.Players.PlayerAdded:Connect(function(ply)
	-- Read datastore and populate Levels table
	
	-- If no data, give starter values:
	Levels[ply.UserId] = {XP = 0, Level = 0, Prestige = 1}

end)

-- Save datastore of the player's progress in session
game.Players.PlayerRemoving:Connect(function(ply)
	-- Save datastore
	-- Flush data from server
	Levels[ply.UserId] = nil
end)
1 Like

This looks awesome! I’m definitely going to try to implement this as part of the system

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.