Unknown Error 'attempt to index local sound'

This is an error that is appearing in a game I am working on. This error does not appear in the Dev place, but instead only appears in the actual game. Both the Dev place and the game are currently the exact same and were published using the same place opened in studio.

Also side note that this error is spamming an insane amount. image

1 Like

I assume these are the scripts responsible for the error, however, they are the default Roblox scripts. I have not edited them in any way and they only error on that specific place.

Relevant part of the default LocalSound script:

        -- this is inside a `do` block which is why it's indented
	local DefaultServerSoundEvent = soundEventFolder:FindFirstChild("DefaultServerSoundEvent")

	if DefaultServerSoundEvent then
		DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition)
			if resetPosition and sound.TimePosition ~= 0 then -- line 91
				sound.TimePosition = 0
			end
			if sound.IsPlaying ~= playing then -- line 94
				sound.Playing = playing
			end
		end)
	end

It’s erroring at 94 and not 91 (which also indexes sound), meaning this only happens when resetPosition is false or nil. Beyond that, I don’t know. I can’t find the script firing this event, it’s not the main Sound script. The only FireClients I can find have to do with ChatServiceRunner, which doesn’t seem to do anything with sounds (it’s firing strings and channels so it would be a different error if it somehow affected this script).

I understand. This is why I am so confused. The exact studio file is now published to 3 different places and it still only errors in one of them. Moving an entire game to a “new game” is not a viable solution.

Does this actually affect sounds or does it just spam the output?

It just spams output. Several errors per second.

Link to place so you can see for yourself: [NEW] Free Falling Simulator - Roblox

As a temporary fix, you can fork the LocalSound script and just add if sound and sound.IsPlaying ~= playing then instead of if sound.IsPlaying ~= playing. I think you should report this as a bug, since it’s a Roblox script, but I’m not sure.

Thanks for responding I honestly thought I was going crazy or was overlooking something. Ill try to add this “fix”

Also note that im currently in a private server and the error is not occurring.