I'm trying to make a gravity falls reference in an elevator where you can press the buttons in a certain order and when it does, it changes a value to be true so the next floor is the gravity falls floor.
However my script just won't work, the first print I provided in the script works but the "if" seems to be like "yeah nope it's not true so not doing the thing" even though it's true?? I don't really know what to try here to fix it so please help!
There're also no errors.
Edit 1: I did some more testing and I realized the script thinks that the ButtonPress values stay false even if I change them to true. I realized this when I changed in the script that instead of true, I made it false. And it works even if I press the button or don't.
(Excuse the messy code)
local Keypad = script.parent.parent.parent local EValues = game.ServerStorage.ElevatorValues local B1 = Keypad["1"]["1"].ButtonPress.Value == true local B2 = Keypad["2"]["2"].ButtonPress.Value == true local B4 = Keypad["4"]["4"].ButtonPress.Value == true local B7 = Keypad["7"]["7"].ButtonPress.Value == true local B8 = Keypad["8"]["8"].ButtonPress.Value == true local B3 = Keypad["1"]["1"].ButtonPress.Value == false local B5 = Keypad["2"]["2"].ButtonPress.Value == false local B6 = Keypad["4"]["4"].ButtonPress.Value == false local B9 = Keypad["7"]["7"].ButtonPress.Value == false local B10 = Keypad["8"]["8"].ButtonPress.Value == false local BBell = Keypad["1"]["1"].ButtonPress.Value == false local BHelp = Keypad["2"]["2"].ButtonPress.Value == false local BClose = Keypad["4"]["4"].ButtonPress.Value == false local cooldown = false local part = script.parent part.ClickDetector.MouseClick:Connect(function() print("Checking if Gravity Falls Reference sequence was pushed correctly.") if cooldown == false and B1 and B2 and B4 and B7 and B8 and B3 and B5 and B6 and B9 and B10 and BBell and BHelp and BClose then EValues.GravityFalls.Value = true print("Someone got the Gravity Falls Reference! Wohoo!!") cooldown = true wait(1) -- testing purposes, once done change to 1800 cooldown = false end end)
I think the problem is that you aren't updating any of your values, so they are just staying static, you could fix this by updating the values before checking them, something like:
local Keypad = script.parent.parent.parent local EValues = game.ServerStorage.ElevatorValues local B1 = Keypad["1"]["1"].ButtonPress.Value == true local B2 = Keypad["2"]["2"].ButtonPress.Value == true local B4 = Keypad["4"]["4"].ButtonPress.Value == true local B7 = Keypad["7"]["7"].ButtonPress.Value == true local B8 = Keypad["8"]["8"].ButtonPress.Value == true local B3 = Keypad["1"]["1"].ButtonPress.Value == false local B5 = Keypad["2"]["2"].ButtonPress.Value == false local B6 = Keypad["4"]["4"].ButtonPress.Value == false local B9 = Keypad["7"]["7"].ButtonPress.Value == false local B10 = Keypad["8"]["8"].ButtonPress.Value == false local BBell = Keypad["1"]["1"].ButtonPress.Value == false local BHelp = Keypad["2"]["2"].ButtonPress.Value == false local BClose = Keypad["4"]["4"].ButtonPress.Value == false local cooldown = false local part = script.parent local function UpdateValues() B1 = Keypad["1"]["1"].ButtonPress.Value == true B2 = Keypad["2"]["2"].ButtonPress.Value == true B4 = Keypad["4"]["4"].ButtonPress.Value == true B7 = Keypad["7"]["7"].ButtonPress.Value == true B8 = Keypad["8"]["8"].ButtonPress.Value == true B3 = Keypad["1"]["1"].ButtonPress.Value == false B5 = Keypad["2"]["2"].ButtonPress.Value == false B6 = Keypad["4"]["4"].ButtonPress.Value == false B9 = Keypad["7"]["7"].ButtonPress.Value == false B10 = Keypad["8"]["8"].ButtonPress.Value == false BBell = Keypad["1"]["1"].ButtonPress.Value == false BHelp = Keypad["2"]["2"].ButtonPress.Value == false BClose = Keypad["4"]["4"].ButtonPress.Value == false end part.ClickDetector.MouseClick:Connect(function() print("Checking if Gravity Falls Reference sequence was pushed correctly.") UpdateValues() if cooldown == false and B1 and B2 and B4 and B7 and B8 and B3 and B5 and B6 and B9 and B10 and BBell and BHelp and BClose then EValues.GravityFalls.Value = true print("Someone got the Gravity Falls Reference! Wohoo!!") cooldown = true wait(1) -- testing purposes, once done change to 1800 cooldown = false end end)
I'm not 100% confident this will work, since I don't have access to the rest of your game, but it should work if I understand the problem.