PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Resume

Resumes the Sound. Sets Sound/Playing to true. Does not alter Sound/TimePosition and thus can be used to resume the playback of a sound stopped using Sound/Pause.

The impact of the different sound functions on Sound/Playing and Sound/TimePosition are shown below.

Function Sound.Playing Sound.TimePosition
Sound:Play() True Last value set in Lua (default 0)
Sound:Pause() False -
Sound:Resume() True -
Sound:Stop() False 0

Returns

Return Type Summary

Code Samples


Sound Functions

This sample gives a simple demonstration of what each of the Sound functions (Sound.Play, Sound.Stop, Sound.Pause and Sound.Resume) do to Sound.Playing and Sound.TimePosition.

-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://301964312"

if not sound.IsLoaded then
	sound.Loaded:wait()
end

-- listen for events
sound.Played:Connect(function(soundId)
	print("Sound.Played event")
end)

sound.Paused:Connect(function(soundId)
	print("Sound.Paused event")
end)

sound.Resumed:Connect(function(soundId)
	print("Sound.Resumed event")
end)

sound.Stopped:Connect(function(soundId)
	print("Sound.Stopped event")
end)

sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0

wait(10)

sound:Pause()
print("pause", sound.Playing, sound.TimePosition) -- pause false 10

wait(3)

sound:Resume()
print("play", sound.Playing, sound.TimePosition) -- play true 10

wait(3)

sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0

wait(3)

sound:Play()
print("play", sound.Playing, sound.TimePosition) -- play true 0