Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

For some reason this won't open the door?

Asked by 2 years ago
local allowed = {5}

local part1 = script.Parent.Parent.Union1
local part2 = script.Parent.Parent.Union2
local part3 = script.Parent.Parent.Union3
local part6 = script.Parent.Parent.RFID1.Union
local part7 = script.Parent.Parent.RFID1.LED
local part8 = script.Parent.Parent.Part


function openclose()
    part1.Transparency = 1
    part1.CanCollide = false
    part2.Transparency = 1
    part2.CanCollide = false
    part3.Transparency = 1
    part3.CanCollide = false
    part6.Transparency = 1
    part6.CanCollide = false
    part7.Transparency = 1
    part7.CanCollide = false
    part8.Transparency = 1
    part8.CanCollide = false
    wait(1)
    part1.Transparency = 0
    part1.CanCollide = true
    part2.Transparency = 0
    part2.CanCollide = true
    part3.Transparency = 0
    part3.CanCollide = true
    part6.Transparency = 0
    part6.CanCollide = true
    part7.Transparency = 0
    part7.CanCollide = true
    part8.Transparency = 0
    part8.CanCollide = true
end




script.Parent.Touched:connect(function(hit)
    if hit.Parent.Name == "Staff Card" then
        if hit.Parent.CardNumber == allowed then
        openclose()
        end
    end
end)

Whenever I tried this it did not work at all, it didn't say anything in the output ethier, any help would be appreciated, Thanks!

1 answer

Log in to vote
0
Answered by 2 years ago

Line 44. Assuming "CardNumber" is an IntValue, we can say:

if hit.Parent.CardNumber.Value

And because on line 1 you used a table, you'd say:

if hit.Parent.CardNumber.Value == allowed[1] then -- allowed[1] is the first object in the table, the [1] being the number 5
Ad

Answer this question