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

How do I make a Level up system?

Asked by
Icven 0
6 years ago

I've been trying to code it so that I can have a level up system on this game I'm developing, but it's not working. I need some help. Here's my code:

game.Players.PlayersAdded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' local experience = Instance.new('IntValue', stats) experience.Name = 'EXP' experience.value = 0 local level = Instance.new('IntValue', stats) level.Name = 'Level' level.Value = 0

experience.Changed:connect(function()
    level.Value = math.floor(experience.Value / 1000)
end)

end)

                                    And

local player = game.Players.LocalPlayer local leaderstats = player:WaitForChild('leaderstats') local level = leaderstats:WaitForChild('Level') local xp = player:WaitForChild('EXP')

level.Changed:connect(function() if xp.Value < 1000 then level.Value = 1 end end)

0
P.S. the "And" is NOT a part of the code. Icven 0 — 6y
0
Can you fix the code block User#5423 17 — 6y
0
Yeah the code block is messed up. AdvancedCode 136 — 6y
0
However by the looks of things your code is outdated. For example - :connect is deprecated, use :Connect instead. AdvancedCode 136 — 6y
0
hey, thx but I found a way to make a better and working one. all this info is really helpful anyway and I thank you all. Icven 0 — 6y

Answer this question