Im using BodyVelocity to push nearby players back but they dont get pushed in the right direction.
Script:
local IgnoreList = {}
PushAura.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then -- If Humanoid
local CharHit = part.Parent
if not table.find(IgnoreList,CharHit) then -- If hit is not on ignorelist
table.insert(IgnoreList,CharHit) -- Add to ignorelist
local PlrHit = game:GetService("Players"):FindFirstChild(CharHit.Name)
print(PlrHit)
if PlrHit.Team ~= plr.Team then -- If Hit Player is not on your team
local OppHRP = CharHit:WaitForChild("HumanoidRootPart")
PushAura.CFrame = CFrame.new(PushAura.Position, Vector3.new(OppHRP.Position.X, PushAura.Position.Y,OppHRP.Position.Z)); -- Make Push Aura Face Direction of hit player
PushVel = Instance.new("BodyVelocity")
PushVel.Parent = OppHRP
PushVel.MaxForce = Vector3.new(math.huge, 0, math.huge)
PushVel.Velocity = OppHRP.Position + PushAura.CFrame.LookVector * 50 -- Push hit player in direction of the push aura
end
end
end
end)
Video:
How do I make it so they get pushed away in the right direction?