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

How do I blacklist all of the items in the workspace for Mouse.Hit?

So I wanted to make this fire blast that tracks the mouse hit position, but I do not want it to hit a part in the workspace, only the sky box. I tried doing this -

spawn(function()

	for i, v in pairs(game.Workspace:GetChildren()) do
		
		if v:IsA("Part") then
			
			Mouse.TargetFilter = v
			
		elseif v:IsA("MeshPart") then
			
			Mouse.TargetFilter = v
			
		end
		
	end
	
RunS.Heartbeat:Connect(function()
	if CanControl == true then
				
	GetMouse:FireServer(Mouse.Hit)
		
	end
end)
	
end)

But it didnt blacklist anything it still hit all of the items in the workspace.

1 answer

You can use rays to help. Instead of just a normal ray, you can use " :FindPartOnRayWithIgnoreList"

Here is the link to the website for it, it explains how you can use it, and etc. https://developer.roblox.com/en-us/api-reference/function/WorldRoot/FindPartOnRayWithIgnoreList

Let me know if you need help!

4 comments

0

dude findpartonrayignorelist is depricated

0

It works.

0

It works.

0

It works.

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