Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make sounds change based on the players walkspeed?

So, I have this script:

local char = script.Parent
delay (0, function()
	while wait()do
		if char.Humanoid.FloorMaterial == Enum.Material.Concrete then 		
			char.HumanoidRootPart.Running.SoundId = "rbxassetid://2991635108"
			char.HumanoidRootPart.Running.Volume = 0.1
			char.HumanoidRootPart.Running.PlaybackSpeed = 0.95
		elseif char.Humanoid.FloorMaterial == Enum.Material.Wood then
			char.HumanoidRootPart.Running.SoundId = "rbxassetid://336401972"
			char.HumanoidRootPart.Running.Volume = 0.5
			char.HumanoidRootPart.Running.PlaybackSpeed = 0.85
		end
	end
end)

I would like to know if there was a way that i could make the playbackspeed of the sound increase/decrease based on what the players walkspeed is. For example, if the players walkspeed is 16, then the playbackspeed would be 1; or something like that. ive tried to make an if statement that checks what the players walkspeed is, but that came to no avail. Help would be appreciated

Thanks

2 comments

0

my answer seems to have disappeard...

0

Maybe you could make a while true do loop, take walk speed, divide it by a constant number, set it as your playback speed, wait(.1)?

1 answer

Ok i solved the problem by making the playback speed = the humanoids walkspeed / by a very specific number

This discussion is preserved as it was. New answers, comments, and votes are closed.