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
The surface GUI can only be operated on with a server script, as they can only be seen in the workspace.