forked from antoniasymeonidou/Roblox_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_door.lua
More file actions
51 lines (45 loc) · 1.16 KB
/
code_door.lua
File metadata and controls
51 lines (45 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local Door = script.Parent.Parent.Parent.Door
local input_label = script.Parent.Parent.Screen.SurfaceGui.TextLabel
local EnterButton = script.Parent.Parent.EnterButton
local ClearButton = script.Parent.Parent.ClearButton
local correct_code = "321"
local input = ""
function give_code()
if input == correct_code then
print("Entered Correct Code")
input_label.Text = "Correct Code"
Door.Transparency = 1
Door.CanCollide = false
wait(4)
Door.Transparency = 0
Door.CanCollide = true
return end
print("Incorrect Code")
input = ""
input_label.Text = "Incorrect Code"
end
EnterButton.ClickDetector.MouseClick:Connect(give_code)
function clear_code()
print("Code Cleared")
input = ""
input_label.Text = ""
end
ClearButton.ClickDetector.MouseClick:Connect(clear_code)
function Key1()
print("1")
input = input..1
input_label.Text = input
end
script.Parent.Key1.ClickDetector.MouseClick:Connect(Key1)
function Key2()
print("2")
input = input..2
input_label.Text = input
end
script.Parent.Key2.ClickDetector.MouseClick:Connect(Key2)
function Key3()
print("3")
input = input..3
input_label.Text = input
end
script.Parent.Key3.ClickDetector.MouseClick:Connect(Key3)