So basically I need to make a system that tells when a sound is a certain loudness, to make keyframes.
Only problem is, in my script. I tell how loud the sound is.
Its always 0. So I have no idea why.
can anyone tell me?
local sound = script:FindFirstChild('Music')
local function createKeyFrame(KeyframeTime,position)
local keyframe = Instance.new('NumberValue')
keyframe.Value = KeyframeTime
keyframe.Name = 'Keyframe:'..position
return keyframe
end
local function getKeyFrames(music:Sound)
local keyframes = Instance.new('Folder')
keyframes.Name = 'Keyframes'
keyframes.Parent = music
-- get sound keyframes
local cloneSound = music:Clone()
cloneSound.Volume = 1
cloneSound:Play()
cloneSound.Parent = workspace
local ckf = 1
while cloneSound.Playing do
print(cloneSound.PlaybackLoudness) -- always prints 0
task.wait()
end
end
wait(3)
getKeyFrames(sound)