Unable to cast CordinateFrame to Vector3

Hello, I got the error in the title while trying to RayCast, here is the script:

local HumanoidRootPart = Player.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
	local RayDirection = HumanoidRootPart.CFrame * CFrame.new(0,0,Settings.RenderRange)
	local Result = workspace:Raycast(HumanoidRootPart.Position, RayDirection)

The code are located in a local script and I am using remote event to send the data to two seperate server script.

2 Likes

Changed the local RayDirection = HumanoidRootPart.CFrame * CFrame.new(0,0,Settings.RenderRange) to local RayDirection = HumanoidRootPart.Position * Vector3.new(0,0,Settings.RenderRange) and it worked again.

6 Likes