I am trying to make the feet parts of the player change their position after a certain distance. I want the feet to teleport in front of the player, but I also am trying to make it look like it’s walking.
- What is the issue? Include screenshots/videos if possible!
The problem I’m facing is that I cannot figure out how to do it while also making it look like walking
I know this code is terrible but this is the closest I could get to it moving correctly in both the x and z axis. Here is the section of the code that I need help with.
runserv.RenderStepped:Connect(function()
local distance = (vis.Torso.Position - vis.RightFoot.Position)
local howMuch = 3
local footOffset = 2
if distance.X > howMuch then
vis.RightFoot.Position = Vector3.new( vis.Torso.Position.X + footOffset, 0 , vis.Torso.Position.Z + 1)
elseif distance.X > howMuch-2 then
vis.LeftFoot.Position = Vector3.new( vis.Torso.Position.X , 0 , vis.Torso.Position.Z - 1)
elseif distance.X < -howMuch then
vis.RightFoot.Position = Vector3.new( vis.Torso.Position.X - footOffset , 0 , vis.Torso.Position.Z -1 )
elseif distance.X < -howMuch + 2 then
vis.LeftFoot.Position = Vector3.new( vis.Torso.Position.X, 0 , vis.Torso.Position.Z + 1)
elseif distance.Z > howMuch then
vis.RightFoot.Position = Vector3.new( vis.Torso.Position.X + footOffset, 0 , vis.Torso.Position.Z)
elseif distance.Z > howMuch - 2 then
--is.LeftFoot.Position = Vector3.new( vis.Torso.Position.X, 0 , vis.Torso.Position.Z - 1)
elseif distance.Z < -howMuch then
vis.RightFoot.Position = Vector3.new( vis.Torso.Position.X - footOffset, 0 , vis.Torso.Position.Z)
elseif distance.Z < -howMuch + 1 then
--vis.LeftFoot.Position = Vector3.new( vis.Torso.Position.X, 0 , vis.Torso.Position.Z + 1)
end
end)