I need help making a zigzagging Projectile, but i cant make it zigzag if the bodyvelocity is relative to the world, so if i make it go in the X direction, it always Travels to the X direction, ignoring the parts orientation
local TweenService = game:GetService("TweenService")
local Time = 0.15
script.Parent.Velocity = script.Parent.Parent.CFrame.LookVector * 50
wait(5)
TweenService:Create(script.Parent,TweenInfo.new(Time,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Velocity = (script.Parent.Parent.CFrame.LookVector) + Vector3.new(80,0,0)}):Play()
wait(Time)
while true do
TweenService:Create(script.Parent,TweenInfo.new(Time,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Velocity = (script.Parent.Parent.CFrame.LookVector) + Vector3.new(-160,0,0) }):Play()
wait(Time)
TweenService:Create(script.Parent,TweenInfo.new(Time,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Velocity = (script.Parent.Parent.CFrame.LookVector) + Vector3.new(160,0,0) }):Play()
wait(Time)
end
this code above is telling the velocity to go in a zigzag motion, but depending on the parts orientation, the results vary.