Or, instead of mouse.Hit.p, are there any other methods that can get the mouse's position while filtering out parts?
COMMUNITY QUESTION
Is it possible to filter parts using mouse.Hit.p?
1 answer
This is quite simple! If you intend on "Local Part" as a part in the character instance, it's VERY easy.
For this, you will use RayCasting in a LocalScript, as well as a function to find if something is a character.
local hit = mouse.Hit.p
local ray = Ray.new(
game.Players.LocalPlayer.Character.Torso.CFrame.p,
(game.Players.LocalPlayer.Character.Torso.CFrame.p - hit).unit * 500
)
function FindIfPlayer(part)
if part ~= nil then
if game.Players:findFirstChild(part.Name) ~= nil then
return part.Parent --Return the character as the ignore
end
end
return nil
end
local partHit, Position = workspace:findPartOnRay(ray, FindIfPlayer(partHit))
local MouseHit = Position --Set a new variable of the mouse's hit that ignored characters
Using the above code, it will find parts hit and ignore characters.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Oh, another note: I want to filter out a local part.