So I know about mouse.TargetFilter but I believe it has to be predetermined. How would I go about where there is a part called "IgnorePart" and when a player clicks on it, it ignores it and checks the Mouse.Target of the object behind it?
This is how you would check when the player clicks and get the part behind an object in a local script.
local Mouse = game.Players.LocalPlayer:GetMouse() local Ignore = game.Workspace:WaitForChild("IgnorePart") Mouse.Button1Down:Connect(function() if Mouse.Target == Ignore then Mouse.TargetFilter = Ignore local Target = Mouse.Target print(Target) Mouse.TargetFilter = nil end end)
Since TargetFilter has to be predetermined you would make a ServerScript that searches through workspace and creates a folder of all the ignore objects. You would then create a remote event that sends the folder to the client when they spawn so that can be added to their personal target filter.
-- Server Script local IgnoreFolder = Instance.new("Folder",workspace) -- We need to create a folder to store the ignored parts as the TargetFilter can only be set to one object. (which includes the object's children) for i,v in pairs(game.Workspace:GetChildren()) do -- Runs through children of workspace if v.Name == "IgnorePart" then -- checks if their name is IgnorePart v.Parent = IgnoreFolder end end) game.Players.PlayerAdded:connect(function(plr) game.ReplicatedStorage.IgnoreEvent:FireClient(plr, IgnoreFolder) end)
And then you would use your local script to add it to the target filter:
-- Local Script game.ReplicatedStorage.IgnoreEvent.OnClientEvent:connect(function(IgnoreFolder) Mouse.TargetFilter = IgnoreFolder end)
Glad I could help!