Seems like a dumb question but I'm trying to set up a sensor that detects if its touching another part(named Block).
TopSensor.Touched:connect(function(hit) print "hit" if hit.Name == "Block" then print(hit.Name) TipTriangle.Transparency = 1 LeftTriangle.Transparency = 1 RightTriangle.Transparency = 1 end end)
It won't actually make contact unless the Block isn't anchored.
You could do
if hit.Anchored == true then print("The part is anchored") else print("The part is not anchored!")
You catch the idea right?
TopSensor.Touched:connect(function(hit) print "hit" if hit.Name == "Block" then if hit.Anchored == true then print(hit.Name) TipTriangle.Transparency = 1 LeftTriangle.Transparency = 1 RightTriangle.Transparency = 1 else hit.CanCollide = false end end end)
I put a script inside the Sensor that'd make it stay in place without being anchored
while true do wait() script.Parent.Position = Vector3.new(script.Parent.Parent.Parent.Block.Position.X, script.Parent.Parent.Parent.Block.Position.Y + 10, script.Parent.Parent.Parent.Block.Position.Z) script.Parent.Velocity = Vector3.new(0,0,0) end
It'll shake constantly but it'll stay in the general area. This did fix my problem. Seeing as the only part it can detect is one that isn't anchored.