Unexpected GUI behaviour

  1. What do you want to achieve?
    I want the TextLabel to only appear once in the logging system.

  2. What is the issue?
    The textLabel is duplicating which is weird.
    For example, this is what I am expecting:

[user] is on a streak of [number]!

What I’m getting:

[user] is on a streak of [number]!
[user] is on a streak of [number]!
[user] is on a streak of [number]!
[user] is on a streak of [number]!
  1. What solutions have you tried so far?
    I have not tried any solutions so far.

I theorise that the RemoteEvent might be firing multiple times, causing this behaviour to occur. I could be wrong so yea…

this is the code that i wrote:

numOfPushes.Changed:Connect(function()
    local pushVal = tostring(numOfPushes.Value)
                                        
    if streakNumbers[pushVal] then
        Remotes.onKillStreak:FireAllClients(
            otherPlayer.DisplayName, numOfPushes.Value
        )
     end
end)

-- local script
Remotes.onKillStreak.OnClientEvent:Connect(function(plrName, val)
        local Yeet = Death.Yeet

        local clone = Death.Killed:Clone()
        clone.Parent = Yeet
        clone.TextColor3 = Color3.fromRGB(254, 240, 0)
        clone.Text = string.format("<b>%s</b> is on a pushing streak of <b>%d+</b>! " .. epikWords[math.random(1, #epikWords)], plrName, val)
        
        SoundService["bowl"]:Play()

        task.wait(6)

        clone.Text = ""
        clone:Destroy()
end)

Any help will be greatly appreciated, thanks.

1 Like

Just to clarify, does it duplicate more than once after the first time, or does it duplicate more than once the first time?

1 Like

This code, can be changed to the following:

numOfPushes:GetPropertyChangedSignal("Value"):Connect(function()
    local pushVal = tostring(numOfPushes.Value)
                                        
    if streakNumbers[pushVal] then
        Remotes.onKillStreak:FireAllClients(
            otherPlayer.DisplayName, numOfPushes.Value
        )
     end
end)
1 Like

yea, it duplicates more than once the first time i see the streak message pop up.

aight, will take note of this thank you.

1 Like

Did that resolve your issue? Just so I know of I still need to look into it. :slight_smile:

2 Likes

Appreciate the help so far, but unfortunately did not.
The first streak is detected once someone reaches 5.

I put a print statement for debugging and found it had printed 4 times, meaning the streak message showed up 4 times.
image

1 Like

oh nah, i just wrote “i have been summoned!” in the code for debugging so it’s not a virus or anything just to let you know.

oh mk, will check it out tho thanks.

Stop trying to advertise your antivirus plugin.

3 Likes

By continuously posting about it? On a forum?

2 Likes

Oh wow, that’s very technical. Lots of work looks like it was put in it.

Can you please provide a link to your website?

Also, post updates in your own thread.

Where in your code is the GUI label created?

nvm, fixed it. thanks for the help.