Ray cast hitting players left leg

I am trying to raycast at the ground below the players feet, so I tried to get the humanoid root part and raycasted downward, and when i press test it hits the players “left upper leg,” I need to blacklist the player from being raycasted, but how.

The ray cast is constantly hitting the players “LeftUpperLeg”

I’ve tried making a list for the blacklisted parts and looked on the forums to see how to make tables, I have no clue what to do at this point

local player = game.Players.LocalPlayer
local character = player.Character

local hrp = script.Parent:WaitForChild("HumanoidRootPart")
local rayOrigin = hrp.Position
local rayDirection = Vector3.new(0, -100, 0)

local raycastResult = workspace:Raycast(rayOrigin, rayDirection)

while true do
	wait(0.1)
	print(raycastResult)
end
local player = game.Players.LocalPlayer
local character = player.Character

local hrp = script.Parent:WaitForChild("HumanoidRootPart")
local rayOrigin = hrp.Position
local rayDirection = Vector3.new(0, -100, 0)

local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.FilterDescendantsInstances = {script.Parent}

local result = workspace:Raycast(origin, direction, raycastParams)

local raycastResult = workspace:Raycast(rayOrigin, rayDirection)

while true do
	wait(0.1)
	print(raycastResult)
end

It works, but is there a way to always have the ray cast to always be attached to the player humanoid root part? so wherever the player moves the ray cast also moves with the player

local player = game.Players.LocalPlayer
local character = player.Character

local hrp = script.Parent:WaitForChild("HumanoidRootPart")

local rayDirection = Vector3.new(0, -100, 0)

local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.FilterDescendantsInstances = {script.Parent}



while true do
	wait(0.1)
local rayOrigin = hrp.Position
local result = workspace:Raycast(origin, direction, raycastParams)

	print(raycastResult)
end
1 Like

Thank you very much!

I’ve been trying to get this to work for way too long.

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