I was attempting to make a placement system thing, and I ended up making this as a test but it errored stating that I can’t use tables for TargetFilter. I looked into the API and this does seem to be the case so is there any way I can make it filter out a table instead of just an instance since I don’t want to mess around with my game hierarchy that much.
(simplified the code so you don’t have to look at a bunch of unrelated nonsense)
local mouse = game.Players.LocalPlayer:GetMouse()
local chr = game.Players.LocalPlayer.Character
local camera = workspace.CurrentCamera
mouse.TargetFilter = {
workspace.Dummy,
chr
} -- this i want to use with a table not a model or folder
while game:GetService("RunService").Heartbeat:Wait() do
workspace.Dummy:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p))
end
The Vector2 is there to choose which position from the screen you want to raycast from e.g. if you want to pretend the mouse is in a different position than it actually is. By default it chooses the mouse’s position, which is what you want. After it has a 2D position on the screen to cast from, RbxMouse converts it to a ray in the 3D world.
But you don’t need to think of any of this - with version 4 of the module the code to do what you want is literally just:
local raycastResult = RbxMouse:GetTargetIgnore({workspace.Dummy, chr})