Code:
local Puzzle = script.Parent
local Signal = Puzzle:WaitForChild("Signal")
local LeftSignal = Signal:WaitForChild("Left")
local RightSignal = Signal:WaitForChild("Right")
local CS = game:GetService("CollectionService")
local AvailableColors = {
Color3.fromRGB(255, 89, 89);
Color3.fromRGB(213, 115, 61);
Color3.fromRGB(255, 255, 0);
Color3.fromRGB(70, 209, 102);
}
local SignalColors = {
Solved = Color3.fromRGB(70, 209, 102);
NotSolved = Color3.fromRGB(255, 89, 89);
AccessGranted = Color3.fromRGB(252, 255, 90);
}
local ChosenTargetColor = AvailableColors[math.random(1,#AvailableColors)]
for _, ChangeableColor in pairs(CS:GetTagged("ChangeableColor")) do
ChangeableColor.ClickDetector.MouseClick:Connect(function()
if ChangeableColor.Color ~= ChosenTargetColor then
ChangeableColor.Color = AvailableColors[math.random(1,#AvailableColors)]
end
end)
end
local EscapeDoor = Puzzle:WaitForChild("EscapeDoor")
local Hinges = EscapeDoor:WaitForChild("Hinges")
local LeftHinge = Hinges:WaitForChild("LeftHinge")
local RightHinge = Hinges:WaitForChild("RightHinge")
local ClosingTimeIndicator = EscapeDoor:WaitForChild("ClosingTimeIndicator")
local EscapeDoorOpenTime = 30
local AnimInfo = TweenInfo.new(4.5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
local TS = game:GetService("TweenService")
while true do
ChosenTargetColor = AvailableColors[math.random(1,#AvailableColors)]
LeftSignal.Color = SignalColors.NotSolved
RightSignal.Color = SignalColors.NotSolved
for _, TargetColor in pairs(CS:GetTagged("TargetColor")) do
TargetColor.Color = ChosenTargetColor
end
for _, ChangeableColor in pairs(CS:GetTagged("ChangeableColor")) do
local ColorToSet
repeat
ColorToSet = AvailableColors[math.random(1,#AvailableColors)]
task.wait()
until ColorToSet ~= ChosenTargetColor
ChangeableColor.Color = ColorToSet
end
local CorrectLeftColors
local CorrectRightColors
repeat
CorrectLeftColors = 0
CorrectRightColors = 0
for _, ChangeableColor in pairs(CS:GetTagged("ChangeableColor")) do
if ChangeableColor.Color == ChosenTargetColor then
if ChangeableColor.Parent.Name == "LeftStar" then
CorrectLeftColors += 1
elseif ChangeableColor.Parent.Name == "RightStar" then
CorrectRightColors += 1
end
end
end
if CorrectLeftColors == 4 then
LeftSignal.Color = SignalColors.Solved
end
if CorrectRightColors == 4 then
RightSignal.Color = SignalColors.Solved
end
task.wait()
until CorrectLeftColors == 4 and CorrectRightColors == 4
TS:Create(LeftHinge,AnimInfo,{CFrame = LeftHinge.CFrame * CFrame.Angles(0,math.rad(-120,0))}):Play()
TS:Create(RightHinge,AnimInfo,{CFrame = RightHinge.CFrame * CFrame.Angles(0,math.rad(120,0))}):Play()
task.wait(4.5)
coroutine.resume(coroutine.create(function()
for secs = EscapeDoorOpenTime,0,-1 do
ClosingTimeIndicator:WaitForChild("UI"):WaitForChild("TimeDisplay").Text = "Closing in " .. secs .. "s"
task.wait(1)
end
ClosingTimeIndicator:WaitForChild("UI"):WaitForChild("TimeDisplay").Text = ""
end))
task.wait(EscapeDoorOpenTime)
TS:Create(LeftHinge,AnimInfo,{CFrame = LeftHinge.CFrame * CFrame.Angles(0,0,0)}):Play()
TS:Create(RightHinge,AnimInfo,{CFrame = RightHinge.CFrame * CFrame.Angles(0,0,0)}):Play()
task.wait(4.5)
end
Error area:
TS:Create(LeftHinge,AnimInfo,{CFrame = LeftHinge.CFrame * CFrame.Angles(0,math.rad(-120,0))}):Play()
TS:Create(RightHinge,AnimInfo,{CFrame = RightHinge.CFrame * CFrame.Angles(0,math.rad(120,0))}):Play()
I included both scripts as shown above. I tried many different solutions but I just don’t know what is causing the issue cause I have all the parameters for the tween