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.
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