Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to play custom footsteps sounds on server ?

I am trying to make my own footstep sound effects depending on the material you are currently standing on. I have created a folder inside SoundService called 'Footsteps' and put all my custom sounds with the same name as some of the materials does have inside. Then I created a local script inside StarterCharacterScripts:

local Character = script.Parent
local rootpart = Character:WaitForChild("HumanoidRootPart")
local RunningSound = rootpart:WaitForChild("Running")
local FootstepsSoundGroup = game:GetService("SoundService"):WaitForChild("Footsteps")
local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.Changed:Connect(function(property)
	
	if property == "FloorMaterial" then			
		if FootstepsSoundGroup:FindFirstChild(Humanoid.FloorMaterial) == nil then
			RunningSound.SoundId = FootstepsSoundGroup:WaitForChild("Plastic").SoundId
			RunningSound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild("Plastic").PlaybackSpeed
			RunningSound.Volume = FootstepsSoundGroup:WaitForChild("Plastic").Volume
		else
			RunningSound.SoundId = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).SoundId 
			RunningSound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).PlaybackSpeed
			RunningSound.Volume = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume
		end
	end
end)

The problem is the custom soundeffect plays LOCALY only for the player who is currently walking, other players hear the default roblox plastic foosteps. Is there a way to make everyone hear the correct sound effect?

1 answer

What i do is replicate the local sound to all clients with a remotem using :FireAllClients(), and remember to turn down the default step sound on charadded.

3 comments

0

I found this a bit too complicated, so what I did is that I've created my own footstep script and disabled the original in 'RbxCharacterSounds'

0

but this would take less then 5 lines ;-;

0

like remote:FireAllClients("ChangeStepSound", Player) remote.OnClientEvent:Connect(function(request, data) Player.Character.RootPart.Footsteps.SoundId = xxxxx end)

This discussion is preserved as it was. New answers, comments, and votes are closed.