First things first im making a showcase game and i want custom footstep sounds. So i have 2 audios i put up on roblox and i would like to use them. So how do i use math.random for audios?and i want to make it so when you walk the random sound plays.
COMMUNITY QUESTION
how do i make a footstep sound randomizer?
1 answer
You could add the sounds to a folder in ReplicatedStorage, then do the following:
local audio = math.random(1, #pathToFolderInReplicatedStorage:GetChildren())
audio:Play()
EDIT: Misread, didn't realize you wanted to replace a sound, lol.
You'll want to put this in a LocalScript in StarterCharacterScripts (since you'll be changing default attributes of every character)
player = script.Parent
sounds = player.Head:waitForChild("Running")
local audio = math.random(1, #pathToFolderInReplicatedStorage:GetChildren())
local id = "rbxassetid://"..audio.SoundId
sounds.SoundId = id
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
but where do i put the sound walking code
Updated the answer, let me know if you are curious about anything
its not working tho because when i try the game then it only does the original footstep sound
what do i do