I'm making a button script and it's not working but I can't figure out why..
local SurfaceGui = script.Parent.Parent
local Keypad = SurfaceGui:WaitForChild("Keypad")
local B20 = Keypad.B20
local B21 = Keypad.B21
local B22 = Keypad.B22
local B30 = Keypad.B30
local Door
local player = game.Players.LocalPlayer
local Correct
code = "21"
B20.MouseButton1Down:connect(function()
Correct = false
end)
B21.MouseButton1Down:connect(function()
Correct = true
end)
B22.MouseButton1Down:connect(function()
Correct = false
end)
B30.MouseButton1Down:connect(function()
Correct = false
end)
if Correct == true then
--nice door animation
else
player.Humanoid.Health = 0
end
I'm getting no errors
It is in a LocalScript

3 comments
Well, localScipts cant be in the workspace(well in characters they can)
@theCJaramy7 then how would I kill the player..
I'm just asking for the sake of gaining knowledge. What is Keypad.B## ? What does it refer to?