So basically I want to be able to make parts not trigger mouse.hit.p when they are hovered over, like if they were not there (I still want to be able to see them)
There is a property on the mouse called "TargetFilter" you can basically set this if you want the mouse to simply ignore something.
Example:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local RunService = game:GetService("RunService") RunService.RenderStepped:Connect(function() if (Mouse.TargetFilter ~= workspace) then Mouse.TargetFilter = workspace end end)
Let's say you made a teleport on click script, if my targetfilter was set to workspace then I would have been teleported nowhere.
So, the first thing I would do is set mouse.hit.p as a variable, and when I don't want that variable to be the mouse position, I would set that variable to an empty Vector3.
-- Local Script local mouse = game.Players.LocalPlayer:GetMouse() -- get the local player's mouse local wantMousePosition = false mouse.Move:Connect(function() -- fire the code below when the mouse moves local mousePosition = mouse.Hit.p -- set the mousePosition to a variable if wantMousePosition == false then -- check if we want the mouse position local mousePosition = Vector3.new() -- we do not want the mouse position so we set the mouse position to an empty Vector3 end end)
If this helped, please upvote