How do i change sound timelength?

I want to cut out last part of music

here is screenshot

please help me with this

You could define the time you want it to stop in a script, wait for the sound to reach that point then :Stop() it.

1 Like

i dont know how to script that

Something like

local TIME_LENGTH = 300


Thank you!
do i need to put in in Sound?

You don’t have to, but it might make sense to

You can put i anywhere you just need to access the sound through the script, for example if you put the sound in workspace you type

local sound = game.Workspace.sound
1 Like

It is not working

The name of the sound in workspace isn’t “sound” is “sound1” change the name of the sound or the variable in the script


i changed it now, how do i make it looped?

1 Like

change it to local sound1 = workspace:WaitForChild("sound1")

1 Like

The solution is written below me, but also if you wanted to wait the exact amount of time that the sound lasts, you can replace

local TIME_LENGTH = 68 with local TIME_LENGTH = sound1.TimeLength - Amount you want to shorten the song by

See this page

1 Like

You could easily find your answer with a quick google search.

The point was to end the sound early, which is why it’s a number and not the TimeLength

1 Like

Thank you so much!!! it is working now!!!

TimeLength is a read-only property, although we can “change” it by setting the PlaybackSpeed to
current length/new length:

local Sound = script.Parent 

function SetLength(sound, length)
	sound.PlaybackSpeed = sound.TimeLength/length

--the sound must be loaded, therefore it only works on the client
local load = Sound.IsLoaded or Sound.Loaded:Wait()
SetLength(Sound, 34) --34 is the new length(in seconds)
1 Like

as an additional solution you could use an external program to trim the audio