Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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!

0
dude findpartonrayignorelist is depricated IEntity_303I 80 — 4y
0
It works. JailBreaker_13 350 — 4y
0
It works. JailBreaker_13 350 — 4y
0
It works. JailBreaker_13 350 — 4y
Ad

Answer this question