How to make a level system (without leaderstats)

i want to make a level system which doesnt use a leaderstats and has a bar so been thinking how do i make it so i gain exp everytime i kill a NPC i made?

1 Like

Well, I get that you want to save data without leaderstats. If so, I recommend using DataStores.

This requires some knowledge of Datastore, Tweens, how you get EXP, etc. However, we do NOT tolerate spoon-feeding.

1 Like

i am saying to SPOON FEED i just wanna know what are some ways

If you don’t want to use leaderstats for some reason, have you tried using NumberValues? This allows you to insert numbers inside of the NumberValue, which can be the levels.

If you kill an NPC, you would raise the number value by whatever number you want. For example, if you wanted to raise a value, you would:

NumberValue.Value = NumberValue.Value + 1 (I’ve just made up the variable, “NumberValue”)

This would increase the value by one.

i meant not saying to SPOON FEED

yes thats nice but what abou the bar tho the bar should go up when we kill the npc

i tried the create a level script here is how it went lol

Local GUI = script.parent
Local NumberValue = game.replicatedstorage.NumberValue
Local Players = Game.Player.LocalPlayer
Local NPC = game.workspace.NPC

so now i jsut wanna know how to create the script that finds if the player has killed the NPC

I assume you write the script correctly in the Studio. If not, this is a problem. ServerStorage and Game.Player isn’t correct at all.

i am beginner scripter so i dont really know i just wanna now know the bar tween and how to know if the player has killed the npc

The NPC should have a Humanoid, right? The Humanoid have a default setting with health bar that you could use. If you want to use custom health bar and tweening, you could use documentation. By example, here is a good documentation for Tweens: TweenService | Documentation - Roblox Creator Hub

so what could be the humanoid code something like

local NumV = Game.ReplicatedStorage.NumberValue
local  Leveler = script.parent --leveler is a text label
local HMR = game.workspace.NPC.Humanoid
HMR:TakeDamage(100)

local NumV = Game.ReplicatedStorage.NumberValue
if HMR:Health == 0 then 
 NumV.Value = +5
wait(0.01)
Leveler.Text = "Level 2 "

question in this script how do i make it so the text to something like level 2 to 3
automatically?

You can’t hardcode values like this. You have to concatenate it.

what do you mean? i dont understand

Stuff like this.

LevelText = "Level: ".. level

well so you mean ill just make a table and do this?

local levels =  {1,2,3,4,5,6,7,8,9}
Leveled.Text = Level .. Levels

is it right?

E

Tell me is it right

`

Not a traditional method, but if used properly, yes.
Usually, people concatenate the NumberValue to the string like so–
label.Text = "Level: "..numValue.Value
For now, focus on learning the basics of Roblox Lua, because as of right now, I see all kinds of capitalization errors, syntax issues, indentation issues and a bit more.

Although outdated, I’d watch Peasfactory. Despite his tutorials being old and using deprecated methods, they teach you good programming habits.

Now, with all that being said, keep in mind that Lua is a Procedural Programming Language, and should be thought of as so. Procedural meaning it goes line by line, top to bottom.

Sources:

Good Luck.

That’s rather negative, don’t you think? Give them some courage.