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

Why the sound doesn't play?

Asked by 6 years ago

This script play a sound when the player touch a part, the script works on roblox studio, but it doesn't work in game.

script.Parent.Touched:connect(function()
    if game.SoundService.Sound.IsPlaying == false then
        game.SoundService.Sound:Play()
    elseif game.SoundService.Sound.IsPlaying == true then

    end
end)

1 answer

Log in to vote
0
Answered by 6 years ago

Make sure instead of script its a LocalScript, also to make the sound ONLY play on one's game instead of the whole server you would have to make the Sound in StarterGui and replace some code with this

script.Parent.Touched:connect(function(part)

if game.PlayerGui.Sound.IsPlaying == false then

game.Players[part.Parent.Name].PlayerGui.Sound:Play()

elseif game.PlayerGui.Sound.IsPlaying == true then


    end
end)

This also makes it work, you forgot to put (part) after function in parentheses

Ad

Answer this question