Ok so I’m trying to make a move from aba where Madara send out wood that follows you but i’m not sure how to make it curve based on the distance between the enemy and the player
This is how it came out when I did it.
Code
local go = true
local LastWood = nil
local function ReachedTarget(pos1, pos2)
return (pos1 - pos2).Magnitude <= 5
end
while wait(0.1) do
if go == true then
if LastWood == nil then
local Wood = Instance.new("Part")
Wood.Parent = Character.Effects
Wood.Size = Vector3.new(1,1,7)
Wood.Anchored = true
Wood.CanCollide = true
Wood.Material = Enum.Material.Wood
Wood.Color = Color3.new(0.545098, 0.352941, 0.117647)
Wood.CFrame = Character.HumanoidRootPart.CFrame *
CFrame.new(0,-3,-2) * CFrame.Angles(0,math.rad(45),0)
Wood.CFrame = CFrame.new(Wood.Position,alive.HumanoidRootPart.Position)
LastWood = Wood
if ReachedTarget(LastWood.Position, alive.HumanoidRootPart.Position) then
go = false
end
else
local Wood = Instance.new("Part")
Wood.Parent = Character.Effects
Wood.Size = Vector3.new(1,1,7)
Wood.Anchored = true
Wood.CanCollide = true
Wood.Material = Enum.Material.Wood
Wood.Color = Color3.new(0.545098, 0.352941, 0.117647)
Wood.CFrame = LastWood.CFrame * CFrame.new(0,0,-7)
Wood.CFrame = CFrame.new(Wood.Position,alive.HumanoidRootPart.Position)
LastWood = Wood
if ReachedTarget(LastWood.Position, alive.HumanoidRootPart.Position)then
go = false
end
end
else
break
end
end