Suggestions on A Level System

I do not have much experience when it comes to making a leveling system for sure, or anything relevant. I’d like to know if this is an effective and safe way of making a leveling system? And if not (which I’m HIGHLY sure it’s not) then what can I do?

	XP.Changed:Connect(function(val)
		local LevelUpFeed = ReplicatedStorage.Remotes.LevelUpFeed
		local LevelNeeded = Level.Value + 1
		local LevelInfo = LevelTable.getXPRequirement(tostring(LevelNeeded))
		if val >= LevelInfo.Required then
			Level.Value = Level.Value + 1
			XP.Value = XP.Value - LevelInfo.Required
			Credits.Value = Credits.Value + LevelInfo.Earnings
			LevelUpFeed:FireClient(player, {
				Level = LevelNeeded;
				Earnings = LevelInfo.Earnings;
			})
		end
	end)

This is the function and the level table in the module script that returns the level requirements:

LevelTable = {
	["1"] = {Required = 100, Earnings = 10};
	["2"] = {Required = 350, Earnings = 35};
	["3"] = {Required = 750, Earnings = 75};
	["4"] = {Required = 1200, Earnings = 120};
	["5"] = {Required = 2000, Earnings = 200};
}

function module.getXPRequirement(level)
	local LevelInfo = LevelTable[level]
	return LevelInfo
end

I’m not that good at scripting but I’m learning lol so

I would say to follow this tutorial, it is very in-depth

Got a much larger understanding of a lot of things in general and anything relevant, thanks!

1 Like