I want to make this spear face the direction it is moving, the direction constantly changes so I’m not sure how to go about this. I’ve tried using CFrame.Lookat but it just doesn’t seem to be working.
(https://i.gyazo.com/b4b69891c09ef748aa7339d8ae8f784e.mp4)
if straighten == false then
local launch = script.Launch:Clone()
launch.Parent = spear
game:GetService("Debris"):AddItem(launch,1)
launch:Play()
local moving = script.Moving:Clone()
moving.Parent = spear
moving:Play()
moving.Ended:Connect(function()
local caught = script.Caught:Clone()
caught.Parent = char.HumanoidRootPart
game:GetService("Debris"):AddItem(caught,1)
caught:Play()
end)
while straighten == false do
local r = math.random;
local RandomPoint = CFrame.new(r(-150,150),r(10,40),r(-50,50))
local goal = {
CFrame = spear.CFrame*RandomPoint
}
spear.CFrame = CFrame.lookAt(spear.Position,goal.CFrame.Position)
local move = tweenService:Create(spear,TweenInfo.new(.5),goal)
move:Play()
straighten = true
task.wait(.4)
straighten = false
end
end