Hi, I'm trying to make a grid placement system, and I'm following a tutorial. The following code gives the following error:

function module.Raycast(A, B)
	local ray = Ray.new(
		A,
		(B-A).Unit * 200
	)

	return game.Workspace:FindPartOnRayWithWhitelist(ray, GridTable)
end

That gives the error

  09:04:35.590 - Unit is not a valid member of CFrame
09:04:35.591 - Stack Begin
09:04:35.592 - Script 'ReplicatedStorage.Placement', Line 30 - function Raycast
09:04:35.592 - Script 'Players.Yankue.PlayerGui.LocalScript', Line 14
09:04:35.592 - Stack End

What is CFrame.Unit and why isn't it working? Thanks.

1 comment

0

Arent you supposed to do something like (A.Position - B.Position).Unit?