Event Firing Again and again after fired once??? XP Notification
Asked by
4 years ago Edited 4 years ago
Im having this issue: My notify script where its meant to pop up with this specific level up message which it does but once it does it just loops and loops . Its meant to fire each time a new level. help!
LevelNotify Script:
01 | GUI:WaitForChild( "LevelUp" ).Event:connect( function (lvl) |
02 | if allow and Enabled.Value then |
05 | Label.Text = "LEVEL UP!" |
06 | Level.Text = "NEW LEVEL!" |
07 | local LVL_HUE = math.clamp( tonumber (lvl) or math.random( 1 , 10 ) * 100 , 1 , 1000 ) / 1000 * 0.8333333333333334 |
08 | local color = Color 3. fromHSV(LVL_HUE, 1 , 1 ) |
09 | for i, v in ipairs (Lines) do |
10 | v.BackgroundColor 3 = color |
11 | v.BackgroundTransparency = 1 |
13 | for i, v in ipairs (Lines_LVL) do |
14 | v.BackgroundColor 3 = color |
15 | v.BackgroundTransparency = 1 |
17 | Frame.Position = UDim 2. new( 0.5 , 0 , 0.45 , 0 ) |
18 | Label.TextTransparency, Level.TextTransparency = 1 , 1 |
19 | Label.TextColor 3 , Level.TextColor 3 = color, color |
THE script where i fire the xp notification:
01 | function LevelNotify(lvl) |
02 | Player.PlayerGui.LevelNotify.LevelUp:Fire(lvl) |
04 | function onLevelUp(lvl) |
05 | Info.XP.Bar.Level.Text = "LEVEL " ..lvl |
09 | Database.Notify.OnClientEvent:connect( function (action,...) |
11 | if action = = "new tp" then |
13 | onPointsAdded(vars [ 1 ] ) |
14 | elseif action = = "new level" then |
18 | elseif action = = "new xp" then |
24 | onLevelUp(sendControl( "get level" )) |
25 | onPointsAdded(sendControl( "get tp" )) |
26 | onXPChange(sendControl( "get xp" )) |
All i need is for it to stop looping and only fire when u hit "new level".