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)

5 comments

0

P.S. the "And" is NOT a part of the code.

0

Can you fix the code block

0

Yeah the code block is messed up.

0

However by the looks of things your code is outdated. For example - :connect is deprecated, use :Connect instead.

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.