How to shoot raycast above characters torso

this what i got now but it doesnt work

RayCastCheck(Player.Character.Torso, Player.Character.Torso.CFrame.LookVector + Vector3.new(0,5,0))

how do i make it shoot a raycast up

this is what the raycast function is

local function RayCastCheck(rayOrig, rayDir, IgnoreModel)
	local raycastparams = RaycastParams.new()
	raycastparams.FilterDescendantsInstances = {IgnoreModel}
	local raycastResult = workspace:Raycast(rayOrig, rayDir, raycastparams)
	print(raycastResult)
end

You are giving the Torso as the Origin Position, you have to give it a Vector3, did output not give you an error? Also if you want the Raycast straight up you just gotta put a Vector3 as the direction, no need to do Player.Character.Torso.CFrame.LookVector + Vector3.new(0,5,0)) Try doing this…

RayCastCheck(Player.Character.Torso.CFrame.Position, Vector3.new(0,5,0))
1 Like

Edit: Nvm I forgot how raycasts work for a moment, answer above should be the solution.

RayCastCheck(Player.Character.Torso, Player.Character.Torso.CFrame.UpVector * 5)

Sends a raycast above the players torso 5 studs high, with respect to orientation.

1 Like

Worked thx
you forgot the CFrame.Position after player.character.torso

Ah sorry, I basically wanted to give you the basic idea. Good thing you got it!

1 Like

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