I have this building system and I have made a removing system. The players build their own stuff, but when deleting, the mouse detects the other players’ “invisible” parts as well. I can’t really put all of the parts into 1 folder and targetfilter them. Any other way I can filter mouse objects? (tables)?
if it’s detecting invisible parts that aren’t the players, my only idea right now would be attributes or something similar for each part so it only runs whatever it needs to run if its owned by you
that wouldn’t work as well. The mouse would still detect the parts.
i don’t know how else it could be done, you might need someone better than me to do this
Hello, this isn’t possible, but there is a way to make a custom one that does this using raycasts. I can provide the code below:
local module = {}
local RunService = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Tools = Remotes:WaitForChild("Tools")
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Include
Params.FilterDescendantsInstances = {}
local Camera = workspace:WaitForChild("Camera")
module.GetMouse = function(Args)
local Origin = Camera.CFrame.Position
local Raycast = workspace:Raycast(Origin,Mouse.Hit.LookVector * 99999,Params)
local DesiredCFrame = nil
if Raycast then
DesiredCFrame = CFrame.new(Raycast.Position)
else
DesiredCFrame = CFrame.lookAt(Origin,Mouse.Hit.Position) * CFrame.new(0,0,-99999)
end
return DesiredCFrame
end
module.Init = function()
if RunService:IsClient() then
Tools:WaitForChild("GetMouse").OnClientEvent:Connect(function(Args)
local Remote = Args["Remote"]
Remote:FireServer(module.GetMouse(Args))
end)
end
end
return module
Obviously this is a module script.
Apologies for the code not being commented, this is very old.
Hey! Thanks for the response. How would I make it check if the target is a part?
Instead of using the mouse, you use raycasts to do the same thing.
Then you send out raycasts, and if they hit something, you decide either to return that hit, or fire another raycast past that hit (e.g. if it’s invisible) to look for another potential hit.
There are probably some modules on the forums that let you do this.