When I try to run the bottom code with the code being 1 and door being 1 it does not print correct. It does print Door! and the print of code is correct.
wait(0.5)
local Door1Code = math.random(1111,9999)
game.ServerStorage:WaitForChild("Door1Code").Value = Door1Code
game.ReplicatedStorage.TestCode.OnServerEvent:Connect(function(plr, door, code)
print(plr)
print(door)
print(code)
if door == 1 then
print("Door!")
if code == 1 then
print("Correct!")
return true
end
end
end)