Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why the sound doesn't play?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.