If a team earns a certain amount of points on the leaderboard, an audio specific to their team will play. Here's what I have so far.

function RedChecker(points) -- This is fired when the number of points on the red team changes
    if points >= 100 then -- This then checks if the number of points is over or equal to a certain number of points, in this case 100
        game.Workspace.RedSound:Play() -- This will play the audio for when red team wins, you can change the "RedSound" to whatever you name your sound
    end
end

-- This is exactly the same as the function for red team, instead this is for blue team.
function BlueChecker(points)
    if points >= 100 then
        game.Workspace.BlueSound:Play()
    end
end

game.Workspace.RedPoints.Changed:connect(RedChecker)-- RedPoints would be the name of the IntValue for the red team
game.Workspace.BluePoints.Changed:connect(BlueChecker) -- BluePoints would be the name of the IntValue for the blue team

7 comments

0

Does this not work..? It looks fine. If not, what's the issue with it?

0

I tested it, and for some odd reason, the audio doesn't play...

0

Does the output say anything?

0

Nope. All appears to be fine.

0

To debug, try putting print statements in various locations. ex, put a print statement before line 3. If it prints out when you expect it to, you know the problem is with playing the sound.

0

barty crouch junior. AVADA KEDAVRA

0

I tied debugging it, and all seems to be well. Maybe I should put the IntValues in the script?