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

Why isn't the Player Point awarded on Level up?

Asked by 9 years ago

There shouldn't be a problem, but the point isn't awarded on leveling up, maybe I missed something? This is a Normal, Server Sided script located in the GUI. It does calculate the XP and levels but just the Player Point doesn't work. Glad if one of ya can take a look at it!

wait(0.1)

function GetXp()
    local xp = script.Parent.Parent.Parent.Parent.Parent.leaderstats.XP
    local levels = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level
    if xp.Value > 69 then
        xp.Value = xp.Value - 70
        xp.Value = xp.Value + (xp.Value * 2)
        levels.Value = levels.Value + 1
            pps = game:GetService("PointsService")
            if pps:GetAwardablePoints() >= 1 then
            pps:AwardPoints(g.userId, 1)
            end
    end
    script.Parent.Bar.Size = UDim2.new (0, xp.Value, 1, 0)
    script.Parent.Levels.Text = "Level: " .. levels.Value
    script.Parent.Xp.Text = "XP: " .. xp.Value .. "/70"
    script.Parent.Bar.BackgroundColor3 = Color3.new((70 - xp.Value) / 70, (70 + xp.Value) / 140, 0)
end

function Xp()
    while (script.Parent) do
        GetXp()
        wait()
    end
end

Xp()
  • Michael
0
Well for one thing why not do whenever xp is changed it runs the function rather than do a while true do that just lowers the performance VariadicFunction 335 — 9y

Answer this question