function LevelNotify(lvl)
    Player.PlayerGui.LevelNotify.LevelUp:Fire(lvl)
end
function onLevelUp(lvl)
    LVL_HUE = math.clamp(tonumber(lvl), 1, 100) / 100 * 0.8333333333333334
    Info.XP.Bar.Level.Text = "LEVEL " .. lvl
    Info.XP.Bar.BackgroundColor3 = Color3.fromHSV(LVL_HUE, 1, 0.19607843137254902)
    Info.XP.Bar.Fill.BackgroundColor3 = Color3.fromHSV(LVL_HUE, 1, 1)
end
Database.Notify.OnClientEvent:connect(function(action, ...)
    local vars = {
        ...
    }
    if action == "new tp" then
        onPointsAdded(vars[1])
    elseif action == "new level" then
        onLevelUp(vars[1])
        LevelNotify(vars[1])
    elseif action == "new xp" then
        onXPChange(vars[1])
    end
end)
onLevelUp(sendControl("get level"))
onPointsAdded(sendControl("get tp"))
onXPChange(sendControl("get xp"))

I only want the levelnotify to work when the level has gone up. But it actually does fire a the right time (when u hit a new level) but the issue is once its fired it just loops and doesnt stop after it been fired. And i need it to fire each time a new level is reached ONCE.

1 comment

0

have you tried breaking the loop once it is fired?