I have yet another CFraming problem... and yet again it has to do with doors...
--[Constants]: local Entry = script.Parent local D1 = Entry.L_Door local D2 = Entry.R_Door local CD1 = Entry.B1.ClickDetector local CD2 = Entry.B2.ClickDetector local Move = Entry.Motion local Lock = Entry.Close --[Bool Values]: local Open = false --[String Values]: local TextCode = "ABCD" --[Number Values]: local NumCode = 1234 --[External Values]: local Values = Entry.DoorValues local DoorStatus = DoorValues.Status local DoorFault = DoorValues.Fault local InMotion = DoorValues.Moving local CodeType = DoorValues.C_Type --[0 = No Code, 1 = Keypad, 2 = Number, 3 = Group, 4 = Specific Person/People] --[Code]: function MoveDoors(User) --PromptCode(User) if Open == false and (DoorStatus.Value ~= 4) then DoorStatus.Value = 4 OpenDoors() DoorStatus.Value = 2 elseif Open == true and (DoorStatus.Value ~= 3) then DoorStatus.Value = 3 CloseDoors() DoorStatus.Value = 1 end end function PromptCode(User) if CodeType.Value ~= 0 then --Incomplete function, I got this... elseif CodeType.Value == 0 then --FutureCodeToCome end end function OpenDoors() if InMotion.Value == true then return end InMotion.Value = true Lock:Stop() Move:Play() for M = 1, 60 do D1.CFrame = D1.CFrame * CFrame.new(-0.2,0,0) D2.CFrame = D2.CFrame * CFrame.new(0.2,0,0) Wait(0.05) end Move:Stop() InMotion.Value = false Lock:Play() Open = true Wait(1.5) end function CloseDoors() if InMotion.Value == true then return end InMotion.Value = true Lock:Stop() Move:Play() for M = 1, 60 do D1.CFrame = D1.CFrame * CFrame.new(0.2,0,0) D2.CFrame = D2.CFrame * CFrame.new(-0.2,0,0) Wait(0.05) end Move:Stop() InMotion.Value = false Lock:Play() Open = false Wait(1.5) end CD1.MouseClick:connect(function(P) MoveDoors(P) end) CD2.MouseClick:connect(function(P) MoveDoors(P) end)
As you may be able to tell, this is one of my newer codes... so it's more structured...
Some of your values are incorrect. The whole "External Values" section is wrong because you connect them to nil values. You have to connect it to the game, or to another Variable, and in this case you have done neither. It would have to look something like this:
--[External Values]: local Values = game.Workspace.Entry.DoorValues local DoorStatus = game.Workspace.Entry.DoorValues.Status local DoorFault = game.Workspace.Entry.DoorValues.Fault local InMotion = game.Workspace.Entry.DoorValues.Moving --I'm not sure if "Moving" is a value. I assume it's a debounce, so I'll leave it be. local CodeType = game.Workspace.Entry.DoorValues.C_Type --[0 = No Code, 1 = Keypad, 2 = Number, 3 = Group, 4 = Specific Person/People
Fix your other values as well, make sure to properly write the hierarchy.
Also, are "Lock" and "Move" audio bits? If not, then :Stop and :Play are useless.
Lastly, your connection line is.. Strange, to say the least. I'm not sure if that is actually a functioning bit of code, as I've never seen something like that, but your connection line should look something like this:
CD1.MouseButton1Down:connect(MoveDoors) --I'm not sure if MouseButton1Down works on parts, if not then my apologies, as I mostly work with Guis. CD2.MouseButton1Down:connect(MoveDoors)
Try that, and then let me know what your Output says and what specifically the problem is.