Currently , I use raycast to detect enemies for my sword game. when MouseButton1Down , a Ray will be cast to ' Mouse.hit.p '. The problem is , My sword game has a combo , when I 'Spam' left mouse click , the player will do an intense combo animation. I successfully made a combo which damage a humanoid. But what if there is more than 1 humanoid in front of the player?

Can I use the -

local Parts = workspace:FindPartOnRay(ray,parts to ignore)

for i = 1,#Parts do
	if Parts[i] then
			------ // Script
	end
end

Sorry if this sounds like a 'Request' , I just want you guys help me solve this question.

1 comment

0

Rays have a CFrame that you can use magnitude with to do this