Hey,
I am making a famous “pipe puzzle” which looks like this:
And mine looks like this now:
The problem I am struggling with is that the wires keep turning on even if I do this:
Before:
After:
![IMG](http://devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/5X/8/f/a/d/8fadc55a47b0e6b1a85ffdf3de87a4ee6c5f96e6.jpeg)
So even if I connect one pipe in the wrong direction, the upper ones still have power. The reason is that each one checks if there is power in the other, and if there is, it turns on. The pipes don’t care about how they are connected to others, as long as there is power. I have struggled with this issue for a long time and need your help to solve it. I can’t manage on my own. I’ve already tried everything.
And here is the code for one pipe. All the others are almost exactly the same.
local prox = script.Parent.Part.ProximityPrompt
local model = script.Parent.Part
local TweenService = game:GetService("TweenService")
local function rotateModel()
local currentOrientation = model.CFrame
local goalCFrame = model.CFrame * CFrame.Angles(math.rad(90), 0, 0)
local tweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
)
local tween = TweenService:Create(model, tweenInfo, {CFrame = goalCFrame})
tween:Play()
end
prox.Triggered:Connect(rotateModel)
while true do
wait(.1)
script.Parent.Part.Color = Color3.fromRGB(0,0,0)
script.Parent.Connector.Color = Color3.fromRGB(0,0,0)
script.Parent.Connector2.Color = Color3.fromRGB(0,0,0)
local touchingParts = script.Parent.Connector:GetTouchingParts()
local touchingParts2 = script.Parent.Connector2:GetTouchingParts()
local touchingParts3 = script.Parent.no:GetTouchingParts()
local touchingParts4 = script.Parent.no2:GetTouchingParts()
local isTouchingLazer = false
local isTouchingLazerF = false
for _, part in ipairs(touchingParts) do
if part.Name == "Union" or part:IsA("Part") and part.Parent ~= script.Parent and part.Transparency == 0 then
if part.Parent:FindFirstChild("Part").Color == Color3.fromRGB(118, 197, 168) then
isTouchingLazer = true
break
end
end
end
for _, part in ipairs(touchingParts2) do
if part.Name == "Union" or part:IsA("Part") and part.Parent ~= script.Parent and part.Transparency == 0 then
if part.Parent:FindFirstChild("Part").Color == Color3.fromRGB(118, 197, 168) then
isTouchingLazer = true
break
end
end
end
if isTouchingLazer then
script.Parent.Part.Color = Color3.fromRGB(118, 197, 168)
script.Parent.Connector.Color = Color3.fromRGB(118, 197, 168)
script.Parent.Connector2.Color = Color3.fromRGB(118, 197, 168)
script.Parent.Union.Value.Value = true
else
script.Parent.Union.Value.Value = false
end
end
If you need more information, don’t be afraid to ask. I just want to get rid of this problem.