Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
NRCme 0
8 years ago

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

1
Well, localScipts cant be in the workspace(well in characters they can) theCJarmy7 1293 — 8y
0
@theCJaramy7 then how would I kill the player.. NRCme 0 — 8y
0
I'm just asking for the sake of gaining knowledge. What is Keypad.B## ? What does it refer to? RAYAN1565 691 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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

Ad

Answer this question