I want to cut out last part of music
here is screenshot
please help me with this
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.
i dont know how to script that
Something like
local TIME_LENGTH = 300
sound:Play()
task.wait(TIME_LENGTH)
sound:Stop()
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
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?
change it to local sound1 = workspace:WaitForChild("sound1")
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
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
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
end
--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)
as an additional solution you could use an external program to trim the audio
local sound = script.Parent.sound1
local TIME_LENGTH = 300
while true do
sound:Play()
task.wait(TIME_LENGTH) -- the sound will play again that makes the sound stop and play again (Looped)
end
edit: to explain he want to stop and play the song at a Specific time. That means he cant use the Normal āLoopedā function thats already on sounds. thats why he need to use a Loop in the Script as well.