A problem with my script. .

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)

Try printing this instead since you’re changing the Volume:

cloneSound.Volume

Parent the clone sound to game.SoundService, then try it.

Did not work, sadly
Thanks for trying

1 Like

Is the sound playing in the first place? Or is the problem just the print function?

Yes it is playing. If you look in the script you can see

Try printing the Volume, then print it. Then let’s see what happens.

The volume is 1. I need to find how loud it is. Not the volume, but the loudness of the sound at that moment

The sound is playing. The volume is 1 so you can here it