0

# Is my if statement formatted incorrectly?

I'm trying to get the CFrame code in the if statement to work. Outside of the if statement it works just fine and the print functions outputs true (Which is what should be happening when I click.) It's only until I try to make the code only run when both of the keyClicked variables are. I'm not sure if I'm formatting the if statement incorrectly or not because I also don't get any errors in the console. How could I fix this?

keyOne.ClickDetector.MouseClick:Connect(function()
keyOneClicked = true
print(keyOneClicked)
return keyOneClicked
end)

keyTwo.ClickDetector.MouseClick:Connect(function()
keyTwoClicked = true
print(keyTwoClicked)
return keyTwoClicked
end)

if keyOneClicked == true and keyTwoClicked == true then
for i = 1, 10  do