Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

im trying to make players need more XP per lvl plz help [solved]?

heres my script

game.Players.PlayerAdded:Connect(function(plr)

    local stats = Instance.new("IntValue",plr)
    stats.Name = "leaderstats"

    local Gold = Instance.new("IntValue",stats)
    Gold.Name = "Gold"
    Gold.Value = 0

    local XP = Instance.new("IntValue",stats)
    XP.Name = "XP"
    XP.Value = 0

    local lvl = Instance.new("IntValue",stats)
    lvl.Name = "lvl"
    lvl.Value = 0

local xpneeded = 99 + (25 * lvl.Value)

        XP.Changed:connect(function()
	if XP.Value > xpneeded then
        lvl.Value = lvl.Value + 1
		XP.Value = 0
end

 
    end)
end)

4 comments

0

It seems like you did it good, what is going wrong here?

0

nvm i just need to local xpneeded in the XP changed function

0

Make sure to edit your title and put [SOLVED] after it.

0

k thx

1 answer

here is the working script

game.Players.PlayerAdded:Connect(function(plr)

    local stats = Instance.new("IntValue",plr)
    stats.Name = "leaderstats"

    local Gold = Instance.new("IntValue",stats)
    Gold.Name = "Gold"
    Gold.Value = 0

    local XP = Instance.new("IntValue",stats)
    XP.Name = "XP"
    XP.Value = 0

    local lvl = Instance.new("IntValue",stats)
    lvl.Name = "lvl"
    lvl.Value = 0



        XP.Changed:connect(function()
	local xpneeded = 99 + (25 * lvl.Value) --- heres where the xpneeded needs to get created
	if XP.Value > xpneeded then
        lvl.Value = lvl.Value + 1
		XP.Value = 0
end

 
    end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.