To disable camera collisions, the easiest way would be overwriting Roblox’s default camera controller. To do this, just click Test in Roblox Studio and find “PlayerModule” under your player’s PlayerScripts and copy it to clipboard:
Once you’ve done that, quit the test server and paste it into StarterPlayerScripts (make sure not to change the names of anything). Then find [PlayerModule -> CameraModule -> ZoomController -> Popper] and open the script. Then scroll down to about line 197, find the function canOcclude(part) and change it to include your own custom condition like so:
local function canOcclude(part)
return
getTotalTransparency(part) < 0.25 and
(FFlagUserRaycastUpdateAPI or part.CanCollide) and
subjectRoot ~= (part:GetRootPart() or part) and
not part:IsA("TrussPart") and
not part:HasTag("YourTagNameHere")
end
Removing “mouse collisions” is a bit trickier. Even parts that are fully transparent and excluded from the mouse’s TargetFilter will still block a ClickDetector from being activated. Your best bet might be to fire a ray from the player’s camera to their mouse hit position:
local CollectionService = game:GetService("CollectionService")
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local mouse = player:GetMouse()
local maxClickDistance = 100 --Change to your heart's content
mouse.Button1Down:Connect(function()
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Include
raycastParams.FilterDescendantsInstances = CollectionService:GetTagged("ClickTag")
local origin = camera.CFrame.Position
local direction = (mouse.Hit.Position - origin).Unit
local raycastResult = workspace:Raycast(origin, direction * maxClickDistance, raycastParams)
if raycastResult then
local partClicked = raycastResult.Instance
--Do whatever else
end
end)
This approach works, but it doesn’t use an actual ClickDetector and is all handled locally, meaning you’ll have to communicate to the server every time the part is clicked. Anyways, I hope this all helps and I wish you the best of luck on your endeavors.