How do i change the walking sound after activating a proximity prompt?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear! To change the footstep sound after a prompt activation

  2. What is the issue? Include screenshots / videos if possible! It says “Running is not a valid member of Part “Workspace.the player name.HumanoidRootPart””

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes, however i could only find how to change the footsteps at the start of the game (i.e. the RbxCharacterSounds script)

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

script.Parent.Triggered:Connect(function(player)
	for _, descendant in pairs(game.StarterPlayer:GetDescendants()) do
		if descendant.Name == "StarterCharacter" then
			descendant:Destroy()
		end
	end
	c = script.Parent.Parent:Clone()
	c.Parent = game.StarterPlayer
	c.ProximityPrompt:Destroy()
	workspace[player.Name].Humanoid.Health = 0
	task.wait(1)
	workspace[player.Name].HumanoidRootPart.Running.SoundId = "174960816"
end)

This is what my script currently looks like. I have tried WaitForChild() but it was the same problem, minus the output error.

1 Like

is there a sound object in the humanoidrootpart named “Running”

Should be, the character spawns in with sound effects every time

when your in playtest check the player’s humanoidrootpart for running or in your script add a debug. for example ex. local check = player.HumanoidRootPart:FindFirstChild(“Running”) if check then

the example did not solve the problem, i put it like this

check = workspace[player.Name].HumanoidRootPart:FindFirstChild(Running)
if check then
print(“works”)
end

it didnt output “works”

it probably didn’t find the running object. try putting a sound object in the humanoidrootpart and name it “Running”

It worked, and now prints “works”

But now there are two running sounds, so how do i make it so it uses the other

are there multiple instances of running in your humanoidrootpart

yes, one already in the character and the other that spawns on play

remove one and check if it works

On the server those walking sounds in humanoidrootpart dont exist, you can only find them locally

when i removed the default one it just no longer plays sound

oh that makes more sense now, i was trying to do this with a sever script all this time

1 Like

Here, i made a mock up, Make a remote event in replicated storage named “Walking”
Proximity Prompt Script

script.Parent.Triggered:Connect(function(player)
	for _, descendant in pairs(game.StarterPlayer:GetDescendants()) do
		if descendant.Name == "StarterCharacter" then
			descendant:Destroy()
		end
	end
	c = script.Parent.Parent:Clone()
	c.Parent = game.StarterPlayer
	c.ProximityPrompt:Destroy()
	workspace[player.Name].Humanoid.Health = 0
	task.wait(1)
	local character = player.Character
	local Remote = game.ReplicatedStorage:WaitForChild("Walking")

	if player then
		local humanoid = character:FindFirstChild("Humanoid")
		local rootPart = character:FindFirstChild("HumanoidRootPart")

		if humanoid and rootPart then
			Remote:FireClient(player)
		end
	end
end)

Then make a local script in StarterPlayerScripts
Local Script

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local remote = game.ReplicatedStorage:WaitForChild("Walking")

remote.OnClientEvent:Connect(function()
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	if humanoidRootPart then
		for _, sound in ipairs(humanoidRootPart:GetDescendants()) do
			if sound:IsA("Sound") and sound.Name == "Running" then
				sound.SoundId = "rbxassetid://174960816" -- ID
			end
		end
	end
end)

Tell me if i did anything wrong or you need help

Thank you, it worked perfectly!

1 Like

You might want to make the 1 second delay to 4 second, if your respawn time is long

My respawn time is 0, its instant

1 Like