Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make a footstep sound randomizer?

Asked by 4 years ago
Edited 4 years ago

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.

1 answer

Log in to vote
0
Answered by
waifuSZN 123
4 years ago
Edited 4 years ago

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
0
but where do i put the sound walking code KolmatYT 0 — 4y
0
Updated the answer, let me know if you are curious about anything waifuSZN 123 — 4y
0
its not working tho because when i try the game then it only does the original footstep sound KolmatYT 0 — 4y
0
what do i do KolmatYT 0 — 4y
Ad

Answer this question