Issue Involving Tween Direction

In this video, you can see that when my dagger tweens to an enemy, it always rotates towards the direction that the part it is heading towards is facing. However, I want to make it so my dagger is headed straight into them from where it is casted. I’m not sure what math I would use to get this and I’ve tried a multitude of solutions and am resorting to making this post.


Edit: Changed this video to mp4 so it would embed.

Here is the code that my dagger is using. SpellTween is what moves the dagger from the player to the target.

local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")

local spell = script.Parent
local spellRemote = RS.HitscanSpellSender

local debounce = true

spellRemote.OnServerEvent:Connect(function(player, target)
	local character = player.Character
	local humanoid = character.Humanoid
	local animator = humanoid.Animator

	local castAnim = Instance.new("Animation")
	castAnim.AnimationId = "rbxassetid://14357528877"

	local castAnimTrack = animator:LoadAnimation(castAnim)

	local projectile = workspace.Particles.HollowKunai
	local projectileClone = projectile:Clone() --need to add overlapparams
	projectileClone.Anchored = true

	castAnimTrack:Play()

	task.wait(0.15)

	projectileClone.Parent = character
	projectileClone.CFrame = character.Head.CFrame * CFrame.new(0,-1,-2.5)
	
	local direction = (target.Position-projectileClone.Position)
	
	local spellTweenInfo = TweenInfo.new(.25, Enum.EasingStyle.Linear)
	local spellTween = TS:Create(projectileClone, spellTweenInfo, {CFrame = CFrame.new(target.Position)})

	if target.Parent.Name ~= player.Name and target.Parent.ClassName == "Model" and debounce == true then
		debounce = false
		spellTween:Play()
		wait(.25)
		target.Parent.Humanoid.Health -= math.random(20,40)
		wait(.25)
		debounce = true
		projectileClone:Destroy()
	elseif projectileClone then
		spellTween:Play()
		wait(.5)
		projectileClone:Destroy()
	end
end)

Any help with this would be greatly appreciated, as I’m new to using CFrame / Vector3 and am very lost.

Why not try and set the rotation first

local spellTweenInfo = TweenInfo.new(.25, Enum.EasingStyle.Linear)
local spellTween = TS:Create(projectileClone, spellTweenInfo, {CFrame = CFrame.new(target.Position)})
projectile.CFrame = CFrame.new(projectileClone.Position,target.Position) -- something like this
-- After this the tween will play
1 Like

I tried something like that before and it did nothing for some reason (that’s why there’s a random variable named direction). Just tried adding yours to my script and it changed nothing as well, thanks for trying though. I think it’s a problem with spellTween’s info. I only want to change position, not orientation, but I’m not sure how I’d do that.