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

Event Firing Repeatedly? Meant to fire each time u reach a new level.

Asked by 4 years ago
01function LevelNotify(lvl)
02    Player.PlayerGui.LevelNotify.LevelUp:Fire(lvl)
03end
04function onLevelUp(lvl)
05    LVL_HUE = math.clamp(tonumber(lvl), 1, 100) / 100 * 0.8333333333333334
06    Info.XP.Bar.Level.Text = "LEVEL " .. lvl
07    Info.XP.Bar.BackgroundColor3 = Color3.fromHSV(LVL_HUE, 1, 0.19607843137254902)
08    Info.XP.Bar.Fill.BackgroundColor3 = Color3.fromHSV(LVL_HUE, 1, 1)
09end
10Database.Notify.OnClientEvent:connect(function(action, ...)
11    local vars = {
12        ...
13    }
14    if action == "new tp" then
15        onPointsAdded(vars[1])
View all 25 lines...

Im trying to make it so it doesnt loop, it only does the lvlnotify fire each time ur at a new level.

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I dont know whats wrong with your script would need more info but this is what i use and its much much better, you can change the xpp required whenever and ittl auto update for the players. the function should be in a module returns a table and you can get the data by doing tbl[1] or tbl[2] or tbl[3] from the returned side

01module.get_rank = function(name)
02    local wins = --Players wins
03    local req = module.start_wins
04    local inc = module.wins_increase
05    local rank = 0
06    repeat
07        if wins >= req then
08            wins = wins - req
09            req = req + inc
10            rank = rank + 1
11        end
12    until wins < req
13    local tbl = {rank, wins, req}
14    return tbl
15end
0
and then have a remote update the client side for all stats instead of 1 remote per stat Vetrodex 22 — 4y
0
it should update whenever theres an xp change or anything Vetrodex 22 — 4y
0
doesnt have to be in a module tho but its just better there Vetrodex 22 — 4y
Ad

Answer this question