i’ve been trying to make procedural leg movement for some time and this is as far as i can get
its supposed to work ONLY for r6 and not for r15, since im unexperienced on that area
i really dont know how to make the legs correctly face the torso like normal legs would
so im kinda stuck and need some help
theres only 1 script and a couple of parts with attachments and stuff
heres the rblx file and the local script’s code
i want to achieve something like Phantom Forces or Strife!'s procedural movement with no keyframes utilized.
leg movin.rbxl (68.7 KB)
local runService = game:GetService("RunService")
local char = script.Parent
local hum : Humanoid = char:WaitForChild("Humanoid")
hum.HipHeight = 0
local rootPart = hum.RootPart or char:WaitForChild("HumanoidRootPart")
local head = char:WaitForChild("Head")
local torso = char:WaitForChild("Torso")
local lArm : BasePart = char:WaitForChild("Left Arm")
local rArm : BasePart = char:WaitForChild("Right Arm")
local lLeg : BasePart = char:WaitForChild("Left Leg")
local rLeg : BasePart = char:WaitForChild("Right Leg")
lLeg.Anchored = true
rLeg.Anchored = true
local lHip : Motor6D = torso:WaitForChild("Left Hip")
local rHip : Motor6D = torso:WaitForChild("Right Hip")
lHip.Enabled = false
rHip.Enabled = false
local lShoulder : Motor6D = torso:WaitForChild("Left Shoulder")
local rShoulder : Motor6D = torso:WaitForChild("Right Shoulder")
local lLegRest = true
local rLegRest = true
local lLegRestPart = game:GetService("ReplicatedStorage"):WaitForChild("restPartPlaceholder"):Clone()
local rLegRestPart = game:GetService("ReplicatedStorage"):WaitForChild("restPartPlaceholder"):Clone()
local attachments = game:GetService("ReplicatedStorage"):WaitForChild("attachments")
local lHipAtt = attachments:WaitForChild("LeftHipAttachment"):Clone()
local rHipAtt = attachments:WaitForChild("RightHipAttachment"):Clone()
lHipAtt.Parent = torso
rHipAtt.Parent = torso
lLegRestPart.Parent = workspace
lLegRestPart.Name = char.Name .. "_lLegRest"
rLegRestPart.Parent = workspace
rLegRestPart.Name = char.Name .. "_rLegRest"
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {char}
params.IgnoreWater = true
params.RespectCanCollide = false
local overParams = OverlapParams.new()
overParams.FilterType = Enum.RaycastFilterType.Exclude
overParams.RespectCanCollide = false
local stepSFX = game:GetService("SoundService"):WaitForChild("Step")
local function moveLeg(name)
if name == "Left" then
local part = lLeg
if table.find(workspace:GetPartsInPart(lLegRestPart,overParams),part) then
lLegRest = true
lLeg.CFrame = CFrame.new(lLeg.Position,lHip.C0.Position)
return
else
lLegRest = false
game:GetService("TweenService"):Create(lLeg,TweenInfo.new(.025,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut,0,false,0),{CFrame = CFrame.new(lLegRestPart.Position + Vector3.new(0,.75,0),lHip.C0.Position)}):Play()
if hum.MoveDirection ~= Vector3.new(0,0,0) then
stepSFX:Play()
end
end
elseif name == "Right" then
local part = rLeg
if table.find(workspace:GetPartsInPart(rLegRestPart,overParams),part) then
rLegRest = true
lLeg.CFrame = CFrame.new(lLeg.Position,rHip.C0.Position)
return
else
rLegRest = false
game:GetService("TweenService"):Create(rLeg,TweenInfo.new(.025,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut,0,false,0),{CFrame = CFrame.new(rLegRestPart.Position + Vector3.new(0,.75,0),rHip.C0.Position)}):Play()
if hum.MoveDirection ~= Vector3.new(0,0,0) then
stepSFX:Play()
end
end
end
end
local function moveArm(name)
if name == "Left" then
local part = lArm
elseif name == "Right" then
local part = rArm
end
end
runService:BindToRenderStep("limbMovement",Enum.RenderPriority.Character.Value,function()
if hum.Health > 0 then
if hum.MoveDirection ~= Vector3.new(0,0,0) then
lLegRestPart.Size = Vector3.new(3,.125,3)
rLegRestPart.Size = Vector3.new(3,.125,3)
else
lLegRestPart.Size = Vector3.new(.25,.00125,.25)
rLegRestPart.Size = Vector3.new(.25,.00125,.25)
end
lLegRestPart.CFrame = (rootPart.CFrame * CFrame.new(-.5, -2.75, 0))
rLegRestPart.CFrame = (rootPart.CFrame * CFrame.new(.5, -2.75, 0))
moveLeg("Left")
moveLeg("Right")
else
lLeg.Anchored = false
rLeg.Anchored = false
end
end)