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

How to add custom footsteps and remove the old roblox footsteps?

Asked by
clrik 8
6 years ago

Is there a way to make custom footsteps in roblox? There was a script I tried to use, but it was 2014 -- outdated.

local player = script.Parent.Parent
repeat wait() until player.Character

--Remove ROBLOX Sounds:
if player.Character:FindFirstChild('Sound') then
    player.Character.Sound:Destroy()
end
for i,object in pairs(player.Character.Head:getChildren()) do
    if object:IsA("Sound") then
        object:Destroy()
    end
end

--Sound Data:
local sound = {
    current = nil
}

--Each table in this list contains the following data (in this order): string SoundId, number Pitch, number Volume, boolean Looped
sound.list = {
    fsConcrete = {"rbxasset://sounds/grassstone2.ogg",1.4,.4,true},
    fsCorrodedMetal = {"rbxasset://sounds/metalgrass.ogg",1.4,.3,true},
    fsDiamondPlate = {"rbxasset://sounds/metalgrass3.ogg",1.4,.3,true},
      fsMetal = {"rbxasset://sounds/metalgrass3.ogg",1.4,.3,true},
    fsFoil = {"rbxasset://sounds/metal3.ogg",1.4,.3,true},
    fsGrass = {"http://www.roblox.com/asset/?id=16720281",1.8,.4,true}, --pitch was 1.4, now 2 so it sounds better. ~maelstronomer
    fsIce = {"rbxasset://sounds/icestone.ogg",1.4,.5,true},
    fsPlastic = {"http://www.roblox.com/asset/?id=121293429",1.8,.3,true}, --131436155,.82,.65 --15174250 old --121293429 roblox
    fsSlate = {"rbxasset://sounds/grassstone3.ogg",1.35,.4,true},
    fsWood = {"rbxasset://sounds/woodgrass3.ogg",1.4,.5,true},
      fsWoodPlanks = {"rbxasset://sounds/woodgrass3.ogg",1.4,.5,true},
    fsSmoothPlastic = {"http://www.roblox.com/asset/?id=121293429",1.8,.3,true}, --131436155,.82,.65 --15174250 old --121293429 roblox

    fsWater = {"http://www.roblox.com/asset/?id=130778103",1.6,.4,true}, --{"http://www.roblox.com/asset/?id=133772590",1,.5,true},--{"http://www.roblox.com/asset/?id=28604165",2.6,.1,true}, --133761592
    fsSnow = {"http://www.roblox.com/asset/?id=19326880",1.2,.5,true},

    jump = {"http://www.roblox.com/asset/?id=161619979",1,.3,false}, --{"rbxasset://sounds/swoosh.wav",1,.3,false},


    fsAir = {'',1,0,false},

    fsBrick = {"rbxasset://sounds/grassstone3.ogg",1.4,.4,true}, --{"rbxasset://sounds/grassstone2.ogg",1.4,.4,true},
      fsCobblestone = {"rbxasset://sounds/grassstone3.ogg",1.4,.4,true}, --{"rbxasset://sounds/grassstone2.ogg",1.4,.4,true},
    fsSand = {"http://www.roblox.com/asset/?id=131245944",1.4,.1,true},
    fsFabric = {"http://www.roblox.com/asset/?id=133705377",1.65,.5,true}, --133705377 --rbxasset://sounds/woodgrass3.ogg
    fsGranite = {"rbxasset://sounds/grassstone3.ogg",1.35,.35,true},
    fsMarble = {"rbxasset://sounds/grassstone2.ogg",1.55,.38,true}, --{"rbxasset://sounds/grassstone3.ogg",1.43,.43,true},
    fsPebble = {"http://www.roblox.com/asset/?id=133761546",1.5,.3,true},--{"rbxasset://sounds/icestone.ogg",1.2,.5,true},  --131620285? --133761546
}

math.randomseed(tick()) --for the random function later ~maelstronomer
--Create Sounds:
for name,data in pairs(sound.list) do
    local s = Instance.new("Sound",player.Character.Head)
    s.Name = name
    s.SoundId = data[1]
    s.Pitch = data[2]
    s.Volume = data[3]*.2 --quiter footsteps because I found them too loud
    s.Looped = data[4]
    --Replaces the ID with the actual sound Object in the above table:
    sound.list[name] = {s,data[2]}
end

--Floor Data:
local ground = {
    part = nil,
    position = nil
}

--Detect Floor:
ground.detect = function()
    --Ignores the player and their camera which allows you to add local parts onto the character without messing this up.
    if player.Character:FindFirstChild('Torso') then
        local ignore = {player.Character,workspace.CurrentCamera}
        local ray = Ray.new(player.Character.Torso.Position,Vector3.new(0,-3.01,0))
        local hit,pos = workspace:FindPartOnRayWithIgnoreList(ray,ignore)
        ground.part = hit
        ground.position = pos
    end
end

local isWalking = false

--Tell the below loop that the player is walking:
player.Character.Humanoid.Running:connect(function(speed)
    if speed > 6 then
        isWalking = true
    else
        isWalking = false
    end
end)

--Play Jump Sound:
player.Character.Humanoid.Jumping:connect(function(state)
    if not script:FindFirstChild('last_jumped') then

        local last_jumped = Instance.new('BoolValue',script)
        last_jumped.Name = 'last_jumped'
        game.Debris:AddItem(last_jumped,.5)

        ground.detect()
        if ground.part then
            if player.Character.Head:FindFirstChild('jump') then
                player.Character.Head.jump.Pitch= math.random((sound.list.jump[2]-.075)*100,(sound.list.jump[2]+.075)*100)/100
                sound.list.jump[1]:Play()
            end
        end
    end
end)

--Loop that Does things:
while wait(.35) do
    --Get the ground:
    ground.detect()

    --Play and stop sounds:
    if isWalking and ground.part then

        --Gets the name of the material without spaces or detects whether the part is called 'Water' or 'Snow':
        local mat
        if ground.part.Name == "Water" or ground.part.Name == "Snow" or ground.part.Name == 'Air' then
            mat = ground.part.Name
        --elseif ground.part.BrickColor == BrickColor.new('Light stone grey') and ground.part.Material=='Sand' then
        --  mat = 'Snow'
        else
            mat = string.sub(tostring(ground.part.Material),15)
            mat = string.gsub(mat, "%s+", "")
        end
        --Plays the sound:
        if sound.current ~= sound.list["fs"..mat][1] then
            if sound.current then sound.current:Stop() end
            sound.current = sound.list["fs"..mat][1]
            sound.current:Play()
        end
        --Determines the pitch of the sound based on the original pitch and the character's walkspeed (where 16 is no change).
        sound.current.Pitch= math.random((sound.list["fs"..mat][2]-.4)*100,(sound.list["fs"..mat][2]+.4)*100)/100
        sound.current.Pitch = sound.current.Pitch/(16/player.Character.Humanoid.WalkSpeed)
    elseif sound.current then
        sound.current:Stop()
        sound.current = nil
    end
end

I want to make my own custom sounds. . . Can someone help me?

0
I wasn't trying to copyright anybody, or steal any scripts, but I just want to know how to make my own. clrik 8 — 6y

1 answer

Log in to vote
1
Answered by
Nowaha 459 Moderation Voter
6 years ago

Edit the "Running" sound in the player's head.

0
I guess that works :3 clrik 8 — 6y
0
I dont know how that works... clrik 8 — 6y
0
Nvm I got it. clrik 8 — 6y
0
Yeah but I cant save it. It always unsaves what I did because I am editing in Play mode christiandaepic 0 — 6y
0
YOu know you should probably use comments if you aren't gonna post an explanation instead. xxIamInevitable 2 — 4y
Ad

Answer this question