Issue
I'm working on a mini fighter. Attacking knocks away the target a certain distance, but sometimes they end up ontop of each other. Movement is automatic(so the game controls both player and AI movement to allow people to focus on comboing(or button mashing if you will).
First idea was just to move the character by walking towards a location, but that isn't exactly ideal because it looks awkward in a fight(turning away from your opponent).
Ideal Solution
Have either player or AI move 'backwards' a certain distance(or magnitude) while facing the other character.
What I have
(Snippet from the code)
local magnitude = (target.Position - torso.Position).magnitude if magnitude >= 7 then script.Parent.Humanoid:MoveTo(target.Position, target) elseif magnitude <= 4 then -- proposed code else script.Parent.Humanoid:MoveTo(torso.Position, torso) end
(TLDR - Moves until they reach a certain distance, otherwise moves if they're too close, and otherwise stands still.)
Is there any way to make a character walk 'backwards'?
I don't know how much this will help you, but this a really rigid way to keep a character walking backwards.
wait(3) game.Players.Player1.DevEnableMouseLock=false local char = workspace.Player1 local dir = char.Torso.CFrame.lookVector local heartbeat = game:GetService('RunService').Heartbeat spawn(function() while heartbeat:wait() do local cf = char.Torso.CFrame char.Torso.CFrame=CFrame.new(cf.p,cf.p+dir*500) end end) while wait() do char.Humanoid:Move(dir*-1) end