How do i make it so footsteps are heard by other players?

Put a local script in startercharacterscripts and made a whole footstep sound depending on what material you walk on, basically what it does in a nutshell is change the walking sound id whenever the part with the material is walked on

My issue is that its only playing the normal roblox walking sounds for other players instead if the custom walking sounds

Heres the script:

local sounds = {
	[Enum.Material.Grass] = "rbxassetid://3477461956",
	[Enum.Material.LeafyGrass] = "rbxassetid://3477461956",
	[Enum.Material.Metal] = "rbxassetid://3477114901",
	[Enum.Material.CorrodedMetal] = "rbxassetid://3477114901",
	[Enum.Material.DiamondPlate] = "rbxassetid://3477114901",
	[Enum.Material.Pebble] = "rbxassetid://3190903775",
	[Enum.Material.Wood] = "rbxassetid://174216216",
	[Enum.Material.WoodPlanks] = "rbxassetid://174216216",
	[Enum.Material.Sand] = "rbxassetid://336575096",
	[Enum.Material.Concrete] = "rbxassetid://3190903775",
	[Enum.Material.Asphalt] = "rbxassetid://5446226292",
	[Enum.Material.Marble] = "rbxassetid://833564121",
	[Enum.Material.Brick] = "rbxassetid://3190903775",
	[Enum.Material.Slate] = "rbxassetid://6514572237"
}


local character = script.Parent

local humanoid = character:WaitForChild("Humanoid")
local rootpart = character:WaitForChild("HumanoidRootPart")

local footsteps = rootpart:WaitForChild("Running")

humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
	local floor = humanoid.FloorMaterial
	local sound = sounds[floor]

	if sound then
		footsteps.SoundId = sound

		if floor == Enum.Material.Concrete or
			floor == Enum.Material.Brick or
			floor == Enum.Material.Asphalt or
			floor == Enum.Material.Pebble then

			footsteps.PlaybackSpeed = humanoid.WalkSpeed / 11.03448275862 --1.45
			footsteps.Volume = 1
		elseif floor == Enum.Material.Sand then

			footsteps.PlaybackSpeed = humanoid.WalkSpeed / 10.66666666666 --1.5
			footsteps.Volume = 2
		elseif floor == Enum.Material.Grass or
			floor == Enum.Material.LeafyGrass then

			footsteps.PlaybackSpeed = humanoid.WalkSpeed / 10.142857142854 --1.75
			footsteps.Volume = 2
		elseif floor == Enum.Material.Metal or
			floor == Enum.Material.CorrodedMetal or
			floor == Enum.Material.DiamondPlate or
			floor == Enum.Material.Wood or
			floor == Enum.Material.WoodPlanks then

			footsteps.PlaybackSpeed = humanoid.WalkSpeed / 10.142857142854 --1.75
			footsteps.Volume = 0.8
		elseif floor == Enum.Material.Marble then
			footsteps.PlaybackSpeed = humanoid.WalkSpeed / 9.01408450704 --1.775
			footsteps.Volume = 2
		end
	else
		footsteps.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
	end
end)

If it’s a LocalScript, I don’t think a client changing the SoundId would replicate to the server.

so would i just be changing the local script in to a regular server script?

Might cause additional strain on the server if you have a lot of players, but it would most likely make the script function properly.

would that affect game performance by chance?

Yes, but it’s probably not that big of a deal if you don’t have that many players per server.

okay so, how would i make my script adaptable to a normal server script? because im not sure how to do that without having to recode my whole script

It should work fine how it currently is.

yeah i tried to change the localscript to a script and now the footsteps dont work at all

You’ll need to make a new sound, as the running sound does not technically exist on the server. Try something like this:

local footsteps = Instance.new("Sound")
footsteps.Parent = rootpart

You’ll also need to toggle it’s .Playing value when the player starts or stops moving. From the client, you’ll want to call :Destroy() on the running sound that is automatically created.

1 Like

alright, thanks alot for the help!

1 Like