You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
-
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
So recently I wanted to have a footstep system that made custom sounds on different materials and match the walk-speed of my character, so I followed a tutorial for this. The problem is that I’m the only person who can make footstep sounds on the game. Any other players cant, but other players can only hear my character’s footsteps. Heres a video showing the problem
Here is a download link to the world containing the scripts im having problems with below:Testworld0102.rbxl (57.6 KB)
The script I used and anything else related to the footsteps are down here. I changed some things in the animate script and in the RbxCharacter scripts. The tutorial utilized named events in the animations and keyframes.
here is what I watched: How to make custom footstep sounds | Roblox Studio - YouTube How to make custom footstep sounds | Roblox Studio - YouTube
Footstep script
---Footstep script----------------------------------------------------------------
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local contentProvider = game:GetService("ContentProvider")
local hum = char.Humanoid
local soundIds = {
grass = "rbxassetid://510933218 Grass";
concrete = "rbxassetid://510933218 Concrete";
Metal = "rbxassetid://510933218 Metal";
}
local leftSounds = {}
local rightSounds = {}
local function convertToSoundObj(id)
local sound = Instance.new("Sound")
local urlAndMaterial = string.split(id, " ")
id = urlAndMaterial[1]
local name = urlAndMaterial[2]
sound.SoundId = id
sound.Name = name
sound.EmitterSize = 4
sound.MaxDistance = 30
if name == "Grass" then
sound.Volume = 0.5
end
return sound
end
for _, v in pairs(soundIds) do
local sound = convertToSoundObj(v)
sound.Parent = char.LeftFoot
leftSounds[#leftSounds + 1] = sound
end
for _, v in pairs(soundIds) do
local sound = convertToSoundObj(v)
sound.Parent = char.RightFoot
rightSounds[#rightSounds + 1] = sound
end
contentProvider:PreloadAsync(leftSounds)
contentProvider:PreloadAsync(rightSounds)
end)
end)
game:GetService("ReplicatedStorage").Event.OnServerEvent:Connect(function(plr, foot)
local char = plr.Character or plr.CharacterAdded:Wait(1)
local hum = char.Humanoid
local function findSound(obj, name)
local s = obj:FindFirstChild(name)
return s
end
local function soundPlay(foot, material)
if material == "WoodPlanks" then material = "Plank" end
if material == "Slate" then material = "Brick" end
if material == "Rock" then material = "Brick" end
if material == "Ground" then material = "DirtORgravel" end
if material == "Mud" then material = "DirtORgravel" end
if foot:FindFirstChild(material) == nil then return end
findSound(foot, material):Play()
end
soundPlay(foot, hum.FloorMaterial.Name)
end)
Changes done to animate script
--added after Line 2
local rightFoot = Character:FindFirstChild("RightFoot")
local leftFoot = Character:FindFirstChild("LeftFoot")
-- added after lines 493
--This is too fire an event everythime a key frame is reached
runAnimTrack:GetMarkerReachedSignal("LeftFootstep"):Connect(function()
game:GetService("ReplicatedStorage").Event:FireServer(leftFoot)
end)
runAnimTrack:GetMarkerReachedSignal("RightFootstep"):Connect(function()
game:GetService("ReplicatedStorage").Event:FireServer(rightFoot)
end)
changes done to rbxCharctersounds script
nullified code from lines 27 - 33
nullified code from lines 157 to 160
nullified code from lines 197 to 201
I don’t know how to fix it,
So can someone help me out?
I mainly want other players to be able to play footstep noises when walking