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

Sound isn't playing, no errors in output console. Why?

My scripting is this.

while true do
	if game.Workspace.TrainCrashed.Value == true then
		script.Parent.Playing = false
		script.Parent.Parent.Nezzera.Playing = true
		
	end
	if game.Workspace.TrainCrashed.Value ~= true then
		script.Parent.Playing = true
		script.Parent.Parent.Nezzera.Playing = false

	end
	wait(0.2)
end

I have checked, TrainCrashed does change when the train crashes, and the names are correct. However, it doesn't work. The sounds do not play at all.

If you need more context, here is the hierarchy:

Soundservice has sound1 and sound2 (Nezzera) in it. Sound1 is the parent of the script in question.

1 comment

0

Some things ill tell you are these, try adding print statements to make sure that the if's are coming back true and that they're even running. Second, instead of doing while true do, try checking if the values changed and firing a function. [TrainCrashed.Changed:Connect(function() end)] this makes it so you can do Sound:Play() instead of playing = true.

1 answer

✓ Accepted answer

Instead of saying

script.Parent.Playing = false

You should do

script.Parent:Play()

And if you want to stop the sound, you should do:

script.Parent:Stop()

Try this instead of doing script.Parent.Playing and tell me the results.

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