Raycasting between to points?

How would I raycast between two points/two positions? Here’s my code but it doesn’t seem to work:

	local Params = RaycastParams.new()
	Params.FilterDescendantsInstances = {workspace.Map}
	Params.FilterType = Enum.RaycastFilterType.Whitelist

	local Origin, Direction = HumanoidRootPart.Position, (HumanoidRootPart.Position - EnemyRoot.Position)
	local Raycast = workspace:Raycast(Origin, Direction, Params)

I’m not sure what I’ve done. Any help is appreciated!

For the direction try doing enemyroot - humanoidroot instead

1 Like

This fixed the problem, thank you!