ClickedConfirmationEvent.OnServerEvent:Connect(function()
local GuessedCombination = {
[1] = Digit1.Value,
[2] = Digit2.Value,
[3] = Digit3.Value,
[4] = Digit4.Value,
[5] = Digit5.Value,
[6] = Digit6.Value,
[7] = Digit7.Value
}
if GuessedCombination == Combination.Value then
print("Correct Combination")
else
print("Wrong Combination")
end
end)
Of course this script doesn’t work, but it’s kind of what I’m going for. The Combination
is a 7 digit lock, and the GuessedCombination is all 7 digits put together.
I think this would work if I knew how to put all 7 digits together, how do I do that?
Something like using tostring to convert all of the entered numbers into a string, then combining them by doing:
local number1 = tostring(Digit1.Value)
local number2 = tostring(Digit2.Value)
local guessedcombination = number1..number2
if guessedcombination = "00" then -- obviously whatever your combination is, make sure you use a string if you converted them earlier
-- do whatever
end