How to make Crouch PlaybackSpeed (SoundPitch) different

I already made the Crouch Script, just need the sound pitch to match the crouch walkspeed with a keycode.

local MaterialSounds = 
	{
		[Enum.Material.Plastic] = "rbxassetid://944075408",
	}

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local FootStepsSound = HumanoidRootPart:WaitForChild("Running")
local Crouch = Enum.KeyCode.C

Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
	local FloorMaterial = Humanoid.FloorMaterial
	local Sound = MaterialSounds[FloorMaterial]
	if Sound then
		FootStepsSound.SoundId = Sound
		FootStepsSound.PlaybackSpeed = 3
	else
		FootStepsSound.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
	end
end)
1 Like

Footstep.PlaybackSpeed = humanoid.WalkSpeed / 1000, change the number until it fits.

1 Like

You have to use the keycode I forgot to say that.

1 Like

Oh I figured it out. Correct me on some things if I made errors. If you jump and have an odd timing you will hear the running walkspeed when crouching.

local MaterialSounds = 
	{
		[Enum.Material.Plastic] = "rbxassetid://944075408",
	}

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local FootStepsSound = HumanoidRootPart:WaitForChild("Running")
local Crouch = Enum.KeyCode.C
local UIS = game:GetService("UserInputService")

Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
	local FloorMaterial = Humanoid.FloorMaterial
	local Sound = MaterialSounds[FloorMaterial]
	if Sound then
		FootStepsSound.SoundId = Sound
		FootStepsSound.PlaybackSpeed = 3
	else
		FootStepsSound.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
	end
end)

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Crouch then
		FootStepsSound.PlaybackSpeed = 1
	end
end)

UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Crouch then
		FootStepsSound.PlaybackSpeed = 3
	end
end)
1 Like

thats the Air material, make it so it wont play any sound if ur in Air

1 Like

Should I use RunService or something?

1 Like

You must check if the footstep is not crouch by using the bot operator, or the not equal to operator.

What is a bot operator? character

Typo, meant not operator. It looks like you are comparing if both are crouch.

Oh. Should I write it differently or something?