Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Button script not working?[closed(fixed problem myself)]

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

1

Well, localScipts cant be in the workspace(well in characters they can)

0

@theCJaramy7 then how would I kill the player..

0

I'm just asking for the sake of gaining knowledge. What is Keypad.B## ? What does it refer to?

1 answer

The surface GUI can only be operated on with a server script, as they can only be seen in the workspace.

This discussion is preserved as it was. New answers, comments, and votes are closed.