Problem with projectile direction

I’m currently making a character shoot out a fireball, and everything is working except the fireball is going into the same direction every time, as shown in the video here:

		fireballa:Play()
		local NearestPlayer = GetNearestPlayer()
		if NearestPlayer == nil then continue end
		Model:SetPrimaryPartCFrame(CFrame.new(Model.PrimaryPart.Position, NearestPlayer.Character.PrimaryPart.Position))
		wait(2)
		local fireballCopy = fireball:Clone()
		local spawnPoint = boss.shootfire
		local speed = 250


		fireballCopy.Position = spawnPoint.Position
		fireballCopy.Parent = game.Workspace

		fireballCopy.Velocity = fireballCopy.CFrame.LookVector * speed
1 Like

That’s because the fireball you are copying is always going to be facing the same direction. So when you are using lookVector it will always be the same as the templates direction.

To fix this is rather simple. Change the line

fireballCopy.Velocity = fireballCopy.CFrame.LookVector * speed

To use the lookVector of the primary part of the Model instead so the fireball will go in the direction the model is facing.

fireballCopy.Velocity = Model.PrimaryPart.CFrame.LookVector * speed
2 Likes

The fireball is 1 part right now though.

2 Likes

That shouldn’t impact this at all. You are just changing the direction of Velocity based off the direction the variable ‘Model’ was set to face. I am assuming that Model is equal to the boss thing that turns to face the player.

2 Likes

Thank you, I will test this as soon as I can.

3 Likes