Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to detect if there's anything between two points??

I am making an npc which shoots even if there is a wall between the target and the npc.

How to make it so that it only shoots if its vacant between the npc's head and target?? Any help would be Highly Appreciated. Thanks in Advance.

1 comment

1

raycasting

2 answers

local function CheckBetween2Points(Point1:BasePart,Point2:BasePart)
	local vector = (Point2.CFrame.Position - Point1.CFrame.Position).Unit
	return workspace:Raycast(Point1.Position,vector*100)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.