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

does anyone know how to make material based footsteps?

Asked by 4 years ago

i want it for the same game i needed the chair stuff for can someone help with this?

0
I do too want to know MediaHQ 53 — 4y

1 answer

Log in to vote
0
Answered by
TGazza 1336 Moderation Voter
4 years ago

funny you should ask. i've made in the past something simular that creates a part where the footstep would be for your character. But i never finished it and if i remeber correctly it's buggy but it works.

if you want to take a look on a way i did this, Heres the code i have:

Must be in a LocalScript!

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Char:WaitForChild("Humanoid",10)
local PossibleFeetNames = {
    Left = {
        "LeftFoot"
    },
    Right = {
        "RightFoot"
    }
}
local FootstepLife = 10


function FindFeet()
    local function GrabFoot(Side)
        local Foot = nil
        for k,v in pairs(PossibleFeetNames[Side]) do
            local Chk = Char:FindFirstChild(v)
            if(Chk ~= nil) then
                return Chk
            end
        end
        return nil
    end
    local LeftFoot = GrabFoot("Left")
    local RightFoot = GrabFoot("Right")
    return LeftFoot,RightFoot
end

local LeftFoot,RightFoot = FindFeet() 

local Feet = {LeftFoot,RightFoot}

local MyFootPrints = {}
local LastFoot = nil
function GetFootPrint(Foot)
    local Part = Instance.new("Part",workspace)
    local HRP = Char:FindFirstChild("HumanoidRootPart")
    local SavedCFrame = Foot.CFrame
    if(HRP ~= nil) then
        local Pos = HRP.Position - Foot.Position
        local x , y , z = HRP.CFrame:ToEulerAnglesXYZ()
        SavedCFrame = CFrame.new(
            (Foot.Position + Vector3.new(0,-(Foot.Size.Y/2),0))) * CFrame.Angles(x,y,z)
    end
    Part.Size = Vector3.new(Foot.Size.X,0.1,Foot.Size.Z)
    Part.CFrame = SavedCFrame 
    Part.Anchored = true
    Part.Locked = true
    Part.CanCollide = false

    local Index = #MyFootPrints+1
    MyFootPrints[Index] = Part
    Part.AncestryChanged:connect(function(part,parent)
        if(MyFootPrints[Index] ~= nil) then
            MyFootPrints[Index] = nil
        end
    end)
    game.Debris:AddItem(Part,FootstepLife)
end


for k,v in pairs(Feet) do
    v.Touched:Connect(function(otr)
        print(table.find(MyFootPrints,otr))
        if(otr:IsDescendantOf(Char) == false and table.find(MyFootPrints,otr) == nil and LastFoot ~= v) then
            --print(otr)
            GetFootPrint(v)
            LastFoot = v
        end
    end)
end

the script still works as of today 07 oct 2020 but it still needs refining and to add the decal foot print to the new'ly created parts.

Hope this helps you getting started! :)

0
think there might be some errors in the footstep table wher its not finding the other foot step parts and starts to spam footsteps parts occasionally lol TGazza 1336 — 4y
0
ok im dumb and ment footstep sounds steel_apples 58 — 4y
Ad

Answer this question