Making sound slower when reaching the end

hey guys!! today ive been trying to make a sound that kind of slows down when its nearing the end buut to no avail. tried scripting something with timeposition but it didnt help that much (maybe i did something wrong) please help

You can do that with Sound.PlaybackSpeed and TweenService. Just task.wait() for however long you want it to play normally, and then play a tween with the remaining time of the sound.

oh? alright, ill try doing that. (didnt know tweens work for playbackspeed)

Tweens can be used for every property. It’s really useful.

extremely weird, but even though i tried to tween it it just… stayed the same. heres the code:

task.spawn(function()
		local newsound = game.ReplicatedStorage.otherstuffs.slamsound:Clone()
		newsound.Parent = newave --the part i wanna parent the sound to
		newsound:Play()
		task.wait(1.8)
		tweenservice:Create(newsound, TweenInfo.new(0.05), {["PlaybackSpeed"] = .2}):Play()
	end)

Idk, works just fine for me.
I tried this. I just added a random audio. Are you sure the speed is not already 0.2 or something? It would be weird but idk.

task.spawn(function()
	local clone = script["Audio/markzuckerberg speech"]:Clone()
	clone.Parent = workspace
	clone:Play()
	task.wait(1.8)
	game.TweenService:Create(clone, TweenInfo.new(0.05), {PlaybackSpeed = 0.2}):Play()
end)

Instead of task.wait(1.8), make a variable:
local waitDur = newsound.TimeLength * 0.8
and then
task.wait(waitDur)

For the tween, 0.05 seconds is too fast, try TweenInfo.new(newsound.TimeLength - waitDur)
and adjust it however you want

ohh i found the issue. silly me destroys the newave before the sound gets to fully play. thanks for the help!

1 Like

oh yeah maybe ill try that too thanks! ill see what fits better

1 Like

After you parent the sound (at newsound.Parent = newave), add this:

if not newsound.IsLoaded then
    newsound.Loaded:Wait()
end

to make sure the sound gets loaded

To delete the sound properly, try this:

local tween = game.TweenService:Create(newsound, TweenInfo.new(numberhere, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {PlaybackSpeed = numberhere})
tween.Completed:Connect(function()
     newsound:Destroy()
end)
tween:Play()