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

Issue with code. Can you help me please? I would really like help. Thank you!

Asked by
moo1210 587 Moderation Voter
6 years ago

I have an issue with the code as it is not working. Here it is

local bool = true
local bool2 = true
local clearance = {
    ["Card-Omni"] = true, 
    ["Card-L5"] = false, 
    ["Card-L4"] = false,
    ["Card-L3"] = false,
    ["Card-L2"] = false,
    ["Card-L1"] = false
}

script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
    if touch.Name == "Handle" and clearance[touch.Parent.Name] and bool then
        bool = false
        script.Parent.Parent.AccessGranted:play()
        script.Parent.Parent.Light1.brickColor = BrickColor.new("Bright green")
        script.Parent.Parent.Light2.brickColor = BrickColor.new("Bright green")
        script.Parent.Parent.RGO.SurfaceGui.Dark.Info.Visible=false
        script.Parent.Parent.RGO.SurfaceGui.Dark.Main.Visible=true
        wait(0.00000001)
        script.Parent.Parent.RGO.SurfaceGui.Dark.Info.Script.Disabled=true
        script.Parent.Parent.RGO.SurfaceGui.Dark.Info.Script.Disabled=false
        wait(1)
        script.Parent.Parent.Light1.brickColor = BrickColor.new("Bright red")
        script.Parent.Parent.Light2.brickColor = BrickColor.new("Bright red")
        bool = true
    elseif touch.Name == "Handle" and not clearance[touch.Parent.Name] and bool2 then
        bool2 = false
        script.Parent.Parent.AccessDenied:play()
        wait(1)
        bool2 = true
    end
end)

As the script that is disabled and enabled that code is

if script.Parent.Visible==true then
    script.Parent.Parent.Parent.Bottom.Home.Visible=false

else 
    script.Parent.Parent.Parent.Bottom.Home.Visible=true
end

Thanks! -Moo1210

1 answer

Log in to vote
0
Answered by 6 years ago

"touched" should be "Touched"

0
That did not do anything. moo1210 587 — 6y
Ad

Answer this question