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)

7 comments
This still didn't work sadly :(, although I did notice something wrong I did. I forgot to change the later numbers B3 and B5 and the rest to their actual numbers. You can see this if you look after Keypad, it still says 1 and 2. I thought this was the problem so I fixed it but it still didn't work.
Here, I decided to upload the required models to roblox for you to check it out. Put the Elevator Values folder inside ServerStorage https://web.roblox.com/catalog/7065892646/Elevator-Keypad
oh i forgot to say, after you press the buttons in the correct order. Press the Open elevator button and it checks to see if you pushed the buttons correctly. What should happen is it says "Yay you did it right" in console and change the GravityFalls value to true inside of the Elevator Values folder.
I will check it out and come back once/if I find something wrong
Never mind! I figured out the answer. You were right about the static values, except you did it wrong. I won't explain what you did wrong since it's complicated but thanks for helping me find the answer!
Nvm I'll just say what you did wrong, I moved the local variables inside of the clickdetector function similar to what you did with the UpdateValues() except that doesn't work since the variables were local so it changed nothing.
oh, i actually found a different solution that worked with my script, but nice problem solving, and thanks for telling me how you made it work for you!