How to make wall tween once all pieces are in a certain orientation

Hello,

So I’m making a puzzle for my horror game where you need to rotate some pieces that you’ll slowly see an image being formed as you finish the puzzle. Once said pieces are all rotated to where the image is complete, a secret wall will be tweened. Here’s a video of what the puzzle looks like right now (don’t mind the picture lol):

As you see, the pieces themselves rotate fine when clicked on, but once all have been rotated to where the image is complete, the red wall I’m testing this on won’t tween? I tried my best going about this but ended up with a pretty messy small script but I hope it makes sense:

local Model = script.Parent
local RightCorner = Model.RightCorner
local MiddleRight = Model.MiddleRight
local Center = Model.Center
local TopRightCorner = Model.TopRightCorner
local MiddleLeft = Model.MiddleLeft
local CenterBottom = Model.CenterBottom
local CenterTop = Model.CenterTop
local TopLeftCorner = Model.TopLeftCorner
local BottomLeftCorner = Model.BottomLeftCorner
local TweenService = game:GetService("TweenService")
local Wall = game.Workspace.TestWall
local WallTween = TweenService:Create(Wall, TweenInfo.new(8, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {CFrame = Wall.CFrame * CFrame.new(0,-10,0)}) -- How long the Tween lasts

local function Tween()
	if RightCorner.Orientation = (-90, 89.99, 0) and MiddleRight.Orientation = (-90, 89.98, 0) and Center.Orientation = (-90, 89.98, 0) and TopRightCorner.Orientation = (-90, 89.98, 0) and MiddleLeft.Orientation = (-90, 89.99, 0) and CenterBottom.Orientation = (-90, 89.98, 0) and CenterTop.Orientation = (-90, 89.99, 0) and TopLeftCorner.Orientation = (-90, 89.99, 0) and BottomLeftCorner = (-90, 89.98, 0) then 
		wait(1)
		WallTween:Play()
		script:Destroy()
	end
end

RightCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)
MiddleRight:GetPropertyChangedSignal("Orientation"):Connect(Tween)
Center:GetPropertyChangedSignal("Orientation"):Connect(Tween)
TopRightCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)
MiddleLeft:GetPropertyChangedSignal("Orientation"):Connect(Tween)
CenterBottom:GetPropertyChangedSignal("Orientation"):Connect(Tween)
CenterTop:GetPropertyChangedSignal("Orientation"):Connect(Tween)
TopLeftCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)
BottomLeftCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)

This is a script from another puzzle where if you had 2 braziers with their fire particle enabled, then a gate would tween just that I tried changing things to orientation here. I’d appreciate your help on this as I’m almost done with the puzzle!

I believe orientation is a Vector3. So, the if statements should look like this:

if RightCorner.Orientation = Vector3.new(-90, 89.99, 0) --etc
1 Like

Yeah I had tried that but then I was getting this error

when there IS a “then” at the end of the long line
image

And so I tried adding an extra = to all of them and the errors seemed to disappear but the wall’s tween still didn’t play. Why could that be?

By the way, here’s the setup in case you were to need to see it:

The model in Workspace
image

The code inside “CheckingRotationsScript” (the code I originally provided):

local Model = script.Parent
local RightCorner = Model.RightCorner
local MiddleRight = Model.MiddleRight
local Center = Model.Center
local TopRightCorner = Model.TopRightCorner
local MiddleLeft = Model.MiddleLeft
local CenterBottom = Model.CenterBottom
local CenterTop = Model.CenterTop
local TopLeftCorner = Model.TopLeftCorner
local BottomLeftCorner = Model.BottomLeftCorner
local TweenService = game:GetService("TweenService")
local Wall = game.Workspace.TestWall
local WallTween = TweenService:Create(Wall, TweenInfo.new(8, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {CFrame = Wall.CFrame * CFrame.new(0,-10,0)}) -- How long the Tween lasts

local function Tween()
	if RightCorner.Orientation = (-90, 89.99, 0) and MiddleRight.Orientation = (-90, 89.98, 0) and Center.Orientation = (-90, 89.98, 0) and TopRightCorner.Orientation = (-90, 89.98, 0) and MiddleLeft.Orientation = (-90, 89.99, 0) and CenterBottom.Orientation = (-90, 89.98, 0) and CenterTop.Orientation = (-90, 89.99, 0) and TopLeftCorner.Orientation = (-90, 89.99, 0) and BottomLeftCorner = (-90, 89.98, 0) then 
		wait(1)
		WallTween:Play()
		script:Destroy()
	end
end

RightCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)
MiddleRight:GetPropertyChangedSignal("Orientation"):Connect(Tween)
Center:GetPropertyChangedSignal("Orientation"):Connect(Tween)
TopRightCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)
MiddleLeft:GetPropertyChangedSignal("Orientation"):Connect(Tween)
CenterBottom:GetPropertyChangedSignal("Orientation"):Connect(Tween)
CenterTop:GetPropertyChangedSignal("Orientation"):Connect(Tween)
TopLeftCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)
BottomLeftCorner:GetPropertyChangedSignal("Orientation"):Connect(Tween)

The code inside “ClickToRotateScript” (all pieces have it):

local info = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
local alreadyTriggered = false
local Puzzle = script.Parent
local ValveClickDetector = script.Parent.ClickDetector



Puzzle.ClickDetector.MouseClick:Connect(function()
	if alreadyTriggered == false then
		alreadyTriggered = true

		local goals = {
			CFrame = Puzzle.CFrame * CFrame.Angles(0,-math.pi/2,0)
		}

		local tween = game:GetService("TweenService"):Create(Puzzle,info,goals)

		ValveClickDetector.MaxActivationDistance = 0
		tween:Play()
		tween.Completed:Wait(1.5)
		ValveClickDetector.MaxActivationDistance = 12
		alreadyTriggered = false
	end
end)

Hopefully this helps more to know what’s going on!