-
What do you want to achieve? Keep it simple and clear!
I would like the players mouse to ignore parts in a folder and go straight through them. I am making a placement system and I don’t want the mouse to be able to stack objects on top of other parts. -
What is the issue? Include screenshots / videos if possible!
I don’t know how to do it. I have used Mouse.TargetFIlter but it hasn’t worked for me -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried YT and Devforum
What are the objects you are trying to filter out, Mouse.TargetFilter may not behave the same way as raycastparams. You might have to pass all of the children to the table. Have you done “Mouse.TargetFilter = Folder:GetChildren()?”
Additionally, could you please provide your code or an error in the output if there is any?
yes i have used it and got an error and yes i am using raycasting
i dont have a code yet for it :|||||||
Wait, so are you using Raycasts or Mouse.Target? If its a raycast you can specify which objects to ignore using RayCastParams. For more information on that look here
ok cool can you make an example code of ignoring a part named TestPart
local raycastparams = RaycastParams.new()
raycastparams.FilterDescendantsInstances = {workspace.TestPart}
raycastparams.FilterType = Enum.RaycastFilterType.Exclude
workspace:Raycast(orign,direction,raycastparams)
Code for Mouse.Target instead of raycasts:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.TargetFilter = {workspace.TestPart}
it doesnt work, i get this error Argument 2 missing or nil and also origin and direction are underlined in orange
also for this one i get this error: Unable to assign property TargetFilter. Object expected, got table
That’s because this is not functional code and shouldn’t be used. I wrote this code to help you understand RayCastParams and is written as an example. If you don’t understand how to use a raycast, then read this documentation page by roblox.
Thats my fault, I thought MouseTargetFilter was a table, apparently it’s just one instance.