My footstep sound script stopped working

Yesterday I made a script that allow players to have differents FootStep sounds when walking, the script was working without problem.

The Script :

local soundtable = {
[“Grass”] = “rbxassetid://833564767”;
[“Concrete”] = “rbxassetid://833564121”;
[“Plastic”] = “rbxassetid://379483672”;
[“SmoothPlastic”] = “rbxassetid://379483672”;
[“Fabric”] = “rbxassetid://133705377”;
[“Glass”] = “rbxassetid://379483672”;
[“Neon”] = “rbxassetid://379483672”;
[“Metal”] = “rbxassetid://379483672”;
[“Air”] = “”;
[“Wood”] = “”;
[“WoodPlanks”] = “”;
[“Slate”] = “”;
[“CorrodedMetal”] = “”;
[“DiamondPlate”] = “rbxassetid://3477114901”;
[“Foil”] = “”;
[“Ice”] = “”;
[“Brick”] = “”;
[“Sand”] = “”;
[“Granite”] = “”;
[“Marble”] = “”;
[“Pebble”] = “”;
[“Cobblestone”] = “”;
[“ForceField”] = “”
}

delay(0, function()

while wait() do
local char = script.Parent
local sound = char.Head.Running
sound.SoundId = soundtable[char.Humanoid.FloorMaterial.Name]
sound.Volume = .2
sound.PlaybackSpeed = math.random(10,12)/10
end

end)

But today, the script stopped working, showing this in output :
image

I looked as server inside the player to find where was located the “Running” sound but I couldn’t find it even if I still hear it…

Does anyone know how to detect the “Running” sound with global script?

1 Like

Sounds are stored in the HumanoidRootPart.

Is there a way to find the sounds with a global script or it will only work with localscripts?

try putting the script in the starter player scripts (a local script) and copy and paste that script into that local script. Tweak it so that it references the right thing

2 Likes

Ok, I tried it and it worked, thx you and 0_1195 for helping, I didn’t know much about this update before.

1 Like

Also, when referencing things inside the character, usually you’d want to use :WaitForChild() rather than directly referencing the object in case it doesn’t exist yet.

1 Like