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

[HELP] Did I script this correctly?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

The script is supposed to play an audio based on which ever team has the correct amount of points. I have inserted the IntValues into workspace, and everything seems fine, but the audio doesn't play. Please help!

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
0
Does the Sound instance in Workspace have an AudioID defined? Is there anything in its properties that mutes the sound? TheArmoredReaper 173 — 8y
0
no you didnt script it correctly dirty_catheter 7 — 8y
0
I don;t know if the AudioID is defined, and there's nothing in properties that mutes it. I'm lost. BartyCrouchJunior 57 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Make sure game.Workspace.BlueSound and game.Workspace.BlueSound have their SoundId set to the Sound ID of the sound you want to play, with the Sound ID being the number at the end of the URL. For example, if you wanted to play this sound, you'd set SoundId to 177080835.

0
They do, but it still doesn't play. They have to be IntValues if I'm not mistaken. BartyCrouchJunior 57 — 8y
Ad

Answer this question