So I have a script that detects if another brick touches brick, I have the brick located in the players HumanoidRootPart. The problem with the script is that it also detects whenever your player touches it. I would just want to know if there is any way to make it so that it doesnt detect your own player touching it.
local plr = game.Players.LocalPlayer
local char = plr.Character
local HRP = char:WaitForChild("HumanoidRootPart")
--Creating the part
local Detector = Instance.new("Part")
Detector.Position = Vector3.new(HRP.Position.X,HRP.Position.Y,HRP.Position.Z)
Detector.Name = "Detector"
Detector.Size = Vector3.new(5,2,5)
Detector.Anchored = false
Detector.Transparency = 0
Detector.CanCollide = true
Detector.Parent = HRP
--Weld
local Weld = Instance.new("Weld", Detector)
Weld.Part0 = HRP
Weld.Part1 = Detector
--Touched Function
Detector.Touched:Connect(function(hit)
if hit.Parent.ClassName == "Part" then
--Do stuff here
end
end)

2 comments
I don't think thats how detector works however you can surely see the magnitude and when its = 0 then the object touches
Are you able to make it so that magnitude works with every brick in the game?