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

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

Asked by 4 years ago
Edited 4 years ago

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)

0
It seems like you did it good, what is going wrong here? User#32819 0 — 4y
0
nvm i just need to local xpneeded in the XP changed function Ninjalord1003 2 — 4y
0
Make sure to edit your title and put [SOLVED] after it. User#32819 0 — 4y
0
k thx Ninjalord1003 2 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)

Ad

Answer this question