#Dynamic Footstep Sounds

1 messages · Page 1 of 1 (latest)

torn pagoda
#

Hi! I'm wanting to add a system into my game that will change the player's footstep sound based on the conditions they're in- which will basically boil down to whether they're intersecting certain parts. However, while I vaguely know how to detect when the player is in contact with something, I'm not really sure how to change the footstep sound dynamically. This project is essentially my first proper learning experience with Roblox development, so I only really know how to change the default sound with the RbxCharacterSounds script. I need some help figuring out how to have a script on the player dynamically change the step sound.

If it changes anything, the game is single player and every script so far is a local script.

proud kayak
#

you cant use local script for everything

#

both server and local scripts will not work in certain conditions or for certain tasks

#

thats one thing

#

second

#

just learn how to manipulate the footsteps sound and how to add more and chnage them like play or smthing

#

the rest is history

torn pagoda
#

i am trying to learn, that's why i'm here. i just wasn't able to figure it out on my own so i came here to get some pointers. saying "just learn" isn't exceptionally... helpful. also, i'm well aware that local and server scripts have different applications, but local scripts have simply been the better choice for everything i've added so far.

errant bridge
torn pagoda
#

inside something, the only things this is really going to interact with are decorations like bushes and shallow water which the player won't be colliding with

#

hence the intersecting

#

i've just not been able to figure out how to dynamically change the sound

errant bridge
torn pagoda
#

yeah, i've done that

#

but i want to write a script that can change the sound dynamically in game, this video just details how to change the footstep sound to one set thing that replaces the default one

#

like, when the player is walking through a bush i want to be able to have that play a different sound than the usual one

#

but i'm not sure how to go about it

errant bridge
torn pagoda
#

well yeah but. how would i refer to it

median cairnBOT
#

studio** You are now Level 1! **studio

torn pagoda
#

i'm not really parsing how the data is stored here

errant bridge
torn pagoda
#

it's not stored as like its own variable

#

hang on

#
local SOUND_DATA : { [string]: {[string]: any}} = {
    Climbing = {
        SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
        Looped = true,
    },
    Died = {
        SoundId = "rbxassetid://9116384757",
    },
    FreeFalling = {
        SoundId = if FFlagFixFreeFallingSound
            then "rbxasset://sounds/action_falling.ogg"
            else "rbxasset://sounds/action_falling.mp3",
        Looped = true,
    },
    GettingUp = {
        SoundId = "rbxasset://sounds/action_get_up.mp3",
    },
    Jumping = {
        SoundId = "rbxassetid://8723348363",
    },
    Landing = {
        SoundId = "rbxasset://sounds/action_jump_land.mp3",
    },
    Running = {
        SoundId = "rbxassetid://9114382576",
        Looped = true,
        Pitch = 1.85,
    },
    Splash = {
        SoundId = "rbxasset://sounds/impact_water.mp3",
    },
    Swimming = {
        SoundId = "rbxasset://sounds/action_swim.mp3",
        Looped = true,
        Pitch = 1.6,
    },
}
#

so i want to be changing the SoundId for running here but i don't understand what i'm really. looking at

#

is this like. an array of arrays? or?

#

i just really don't understand

errant bridge
#

Okay, so play the game. Look in the character in the explorer. Is the footstep sound in there somewhere

torn pagoda
#

!

#

it's in the humanoid root part! thanks so much i wouldn't even have thought to look for the actual like. sound objects

#

beginner problems lol

errant bridge
torn pagoda
#

and so now i should be able to change them in localscripts, right?

errant bridge
torn pagoda
#

it'd be LocalPlayer.Character.HumanoidRootPart.Running.SoundId?

torn pagoda
#

excellent thank you so much

errant bridge
# torn pagoda excellent thank you so much

This script is best for PlayerCharacterScripts

I'm wrong, use WaitForChild for the sound just in case it hasn't loaded in yet, not just .Running, it'd be :WaitForChild("Running")