#Custom walking sounds
1 messages · Page 1 of 1 (latest)
local RunService = game:GetService("RunService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")
local sandSoundId = "rbxassetid://336575096"
local defaultSoundId = "rbxassetid://5446226292"
local runSound = Instance.new("Sound")
runSound.Name = "CustomRunningSound"
runSound.Volume = 1
runSound.Looped = true
runSound.SoundId = defaultSoundId
runSound.Parent = humanoid
RunService.Heartbeat:Connect(function()
for _, child in pairs(humanoid:GetChildren()) do
if child:IsA("Sound") and child.Name == "Running" and child ~= runSound then
child:Destroy()
end
end
end)
local function updateSound()
local rayOrigin = rootPart.Position
local rayDirection = Vector3.new(0, -5, 0)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {character}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local result = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if result and result.Instance and result.Instance.Name == "SandBlock" then
if runSound.SoundId ~= sandSoundId then
runSound.SoundId = sandSoundId
if humanoid.MoveDirection.Magnitude > 0 then
runSound:Play()
end
end
else
if runSound.SoundId ~= defaultSoundId then
runSound.SoundId = defaultSoundId
if humanoid.MoveDirection.Magnitude > 0 then
runSound:Play()
end
end
end
end
RunService.Heartbeat:Connect(function()
updateSound()
end)
humanoid.Running:Connect(function(speed)
if speed > 0 then
if not runSound.IsPlaying then
runSound:Play()
end
else
runSound:Pause()
end
end)
DEFAULT WALKING SOUND KEEPS COMING BACK EVERY TIME
do i just add it to my script
** You are now Level 1! **
yes
yes
did you see the message
uh no
same problem
k
** You are now Level 1! **
okay so
now go inside the rbxcharactersounds script
wait just so i know you're not running the game right
okay
Running = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
Pitch = 1.85,
},
?
to your running sound id
wait
but then if i go over sand
it will be the custom sound 1#
i have 2 custom sounds
one over sand other over everything else
can i just mute it somehow
or make it really quiet
dw
you fiksed it but now there is a sound of the custom walking sound every time i walk over everything
maybe i should just change the audio id to something like no audio
i should find like nothingness
wdym
wait
@formal haven ok now
you make the sand check there
no need to do runservice heartbeat btw
yes
i gotta go
so just dm me if there are any bugs