Raycasting issue

I’m trying to Raycast and place a part under the players’ characters, but i keep getting this weird side effect
image

local rayParams = RaycastParams.new()
			rayParams.FilterType = Enum.RaycastFilterType.Exclude
			rayParams.FilterDescendantsInstances = {char}

			local result = workspace:Raycast(char.PrimaryPart.Position,Vector3.new(0,-1,0)*5000,rayParams)

Would you be able to tell me what this side effect is as I’m not too sure what you mean.

I may have a outcome you may like, where the part does go underneath my player, but I can only do this with the limited information you’ve provided.

        local rayParams = RaycastParams.new()
		rayParams.FilterType = Enum.RaycastFilterType.Exclude
		rayParams.FilterDescendantsInstances = {char} -- Exclude the player's character from the raycast

		local rayOrigin = char.PrimaryPart.Position
		local rayDirection = Vector3.new(0, -1, 0) -- Straight down
		local rayDistance = 5000

		local result = workspace:Raycast(rayOrigin, rayDirection * rayDistance, rayParams)

		if result then
			-- The ray hit something
			local hitPosition = result.Position
			-- Now, you can place a part or perform any other actions using hitPosition
			local newPart = Instance.new("Part")
			newPart.Position = hitPosition
			newPart.Parent = workspace
		else
			-- The ray didn't hit anything
			warn("Raycast didn't hit anything.")
		end

image

1 Like

Thank you for replying, I wasn’t parenting the part to the character so the raycast was detecting it. I just put it in the filter list