local e=script.Parent:WaitForChild("\070\111\111\116\115\116\101\112\083\111\117\110\100\115")local C=script.Parent repeat wait()until C local N=C local L=N.Humanoid local H=L.RootPart local r L.Running:connect(function(e)if e>L.WalkSpeed/2 then r=true else r=false end end)function getMaterial()local e=script.Parent.Head.Footstep end local g local K=false runtime.Heartbeat:connect(function()if r and K==false then local C=getMaterial()if C~=g and g~=nil then e[g].Playing=false end local N=e[C]:Clone()N.Playing=true g=C K=true wait(1.5)K=false N:Destroy()else for e,C in pairs(e:GetChildren())do C.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 material = script.Parent.Head.Footstep
end

local lastmat
local debounce = false
runtime.Heartbeat:connect(function()
	if walking and debounce == false then
		local material = getMaterial()
		if material ~= lastmat and lastmat ~= nil then
			materials[lastmat].Playing = false
		end
		local materialSound = materials[material]:Clone()
		materialSound.Playing = true
		lastmat = material
		debounce = true
		wait(1.5)
		debounce = false
		materialSound:Destroy()
	else
		for _, sound in pairs(materials:GetChildren()) do
			sound.Playing = false
		end
	end
end)
