So,
I am making an FPS game and i made a script that adds custom
footstep sounds but, i can still hear the roblox default footstep sounds.
I’ve tried to remove it by searching where is it located and deleting it,
and i discovered that the footstep sounds are automatically replicated to the
Character’s HumanoidRootPàrt.
I tried making a script that deletes it, but seems like the “Running” Audio is not
visible to scripts and neither to Localscripts.
You could use a for loop to to check the HumanoidRootPart descendants when a player joins.
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local descendants = character.HumanoidRootPart:GetDescendants()
for i, v in pairs(descendants) do
if v:IsA("Sound") then
v:Destroy()
end
end
end)
end)
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local descendants = Character.HumanoidRootPart:GetDescendants()
for i, v in pairs(descendants) do
if v:IsA("Sound") then
v:Destroy()
end
end
If it’s inside StarterCharacterScripts, you can access the player’s character by simply doing script.Parent, since scripts inside here are parented to the player’s character. I should also add that using WaitForChild on the HumanoidRootPart is a good idea.
This is all you need:
local Character = script.Parent
local RootPart = Character:WaitForChild("HumanoidRootPart")
for _,Sound in pairs(RootPart:GetChildren()) do
if Sound:IsA("Sound") then
Sound:Destroy()
end
end