Making this part move forwards

Im currently working on a Projectile System and I created this:

	RunService.Heartbeat:Connect(function(DeltaTime:number)
		for _, Object in Projectiles do
			-- // Move //
			if Object.Health > 0 and Object.Part then
				if not Object.Part.Parent then continue end
				
				local Direction:CFrame = Directions[Object.Direction] or Directions.Forwards
				local Speed = Object.Speed * DeltaTime
				local TravelTo = (Direction * CFrame.new(Speed, Speed, Speed))
				
				-- // Move //
				if Object.Distance > Object.Range then
					-- // Drop Off //
					
				end
				
				
				Object.Part.CFrame *= TravelTo
				Object.Hitbox:CheckForCollisions()
			end
		end
	end)

the idea is that it should move the Object.Part forwards.
The problem is that they kinda go up and to the side, I assume I did something wrong with the TravelTo CFrame, as when the speed is 0, making the TravelTo just a blank CFrame, it works perfectly fine.

So how can I fix this?

Also, these are the Direction that are mentioned in the script

return {
	['Forwards'] = CFrame.new(0,0,-1),
	['Backwards'] = CFrame.new(0,0,1)
}

Hello!

You might have the orientation incorrect. To check this you can right click a part and click “Show Orientation Indicator.”
image
The result will look something like this:
image

from my experience Z is forwards when it comes to CFrames, and well their CFrames, so the rotation wouldnt effect it, it would still move well, forwards.

Wait I think I just figured it out. using the * doesnt multiply, it adds, which would mess it up. Lemme go see if this is the case

Ok that was in fact the issue, thanks for trying to help though!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.