local Q=script.Parent:WaitForChild("\070\111\111\116\115\116\101\112\083\111\117\110\100\115")local x=script.Parent repeat wait()until x local H=x local q=H.Humanoid local E=q.RootPart local K q.Running:connect(function(Q)if Q>q.WalkSpeed/2 then K=true else K=false end end)function getMaterial()local Q=q.FloorMaterial if not Q then Q="\065\105\114"end local x=(string.split(tostring(Q),"\069\110\117\109\046\077\097\116\101\114\105\097\108\046"))[2]local H=x return H end local k runtime.Heartbeat:connect(function()if K then local x=getMaterial()if x~=k and k~=nil then Q[k].Playing=false end local H=Q[x]H.PlaybackSpeed=q.WalkSpeed/12 H.Playing=true k=x else for Q,x in pairs(Q:GetChildren())do x.Playing=false end end end)
--script:WaitForChild('FootstepSounds').Parent = sounds
local materials = script.Parent:WaitForChild("FootstepSounds")
local plr = script.Parent
repeat
	wait()
until plr
local char = plr
local hum = char.Humanoid
local hrp = hum.RootPart
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)
