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

Song not ending?

The song plays and everything it just doesn't get the .Ended part, It doesn't print 'ending song'

y god, y.

for _,k in next,t do
	print('editing values')
	val = val + 1
	scrollframe.Parent.CurrentAudioNumber.Text = "Playing "..val.." out of "..maxnum.. " audios"
	print('playing song')
	k:Play()
	k.Ended:wait()
	print('ending song')
	k:Stop()
end

2 comments

0

make it a function, k.Ended:connect(function() print("Ending Song...") k:Stop() end) or, while k.IsPlaying == true do wait() end

0

Why didn't you just do a wait function

1 answer

✓ Accepted answer

The event Ended only works for LocalScripts, because sounds on ROBLOX are downloaded directly to the client, so are started at different times for each users. Therefore it's impossible for the server to anticipate when the song has ended.

Solution

Well, there technically is no direct solution to this problem. Either you directly input the length of every song manually, or you play all audios locally or you do a mixture of both.

I have had multiple conversations with JParty (ROBLOX Developer Relations) about this problem, and have suggested they do add some sort of SongLength to the Server side of the code.

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