local B=game:GetService("\083\111\117\110\100\083\101\114\118\105\099\101")local I=game:GetService("\082\117\110\083\101\114\118\105\099\101");(script:WaitForChild("\070\111\111\116\115\116\101\112\083\111\117\110\100\115")).Parent=B local f=B:WaitForChild("\070\111\111\116\115\116\101\112\083\111\117\110\100\115")local Z=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer repeat wait()until Z.Character local c=Z.Character local v=c.HumanoidRootPart local M=c.Humanoid local N M.Running:connect(function(B)if B>M.WalkSpeed/2 then N=true else N=false end end)function getMaterial()local B=M.FloorMaterial if not B then B="\065\105\114"end local I=(string.split(tostring(B),"\069\110\117\109\046\077\097\116\101\114\105\097\108\046"))[2]local f=I return f end local q I.Heartbeat:connect(function()if N then local B=getMaterial()if B~=q and q~=nil then f[q].Playing=false end local I=f[B]I.PlaybackSpeed=M.WalkSpeed/12 I.Playing=true q=B else for B,I in pairs(f:GetChildren())do I.Playing=false end end end)


local sounds = game:GetService('SoundService')
local runtime = game:GetService('RunService')
script:WaitForChild('FootstepSounds').Parent = sounds
local materials = sounds:WaitForChild('FootstepSounds')
local plr = game:GetService("Players").LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local hrp = char.HumanoidRootPart
local hum = char.Humanoid
local walking

hum.Running:connect(function(speed)
	if speed > hum.WalkSpeed/2 then
		walking = true
	else
		walking = false
	end
end)

function getMaterial()
	local floormat = hum.FloorMaterial
	if not floormat then floormat = 'Air' end
	local matstring = string.split(tostring(floormat),'Enum.Material.')[2]
	local material = matstring
	return material
end

local lastmat
runtime.Heartbeat:connect(function()
	if walking then
		local material = getMaterial()
		if material ~= lastmat and lastmat ~= nil then
			materials[lastmat].Playing = false
		end
		local materialSound = materials[material]
		materialSound.PlaybackSpeed = hum.WalkSpeed/12
		materialSound.Playing = true
		lastmat = material
	else
		for _,sound in pairs(materials:GetChildren()) do
			sound.Playing = false
		end
	end
end)
