Ad
Log in to vote
0

Trying to trigger this function. Will someone tell me how to call this function correctly?

Asked by 1 month ago
Edited 29 days ago

I'm making a keycard so when it touches the keycardblock it calls a function (no errors in the output). It would be nice if someone could suggest a efficient way to trigger this function, I did the best I could but nothing happens.

local KeyCardBlock = game.workspace.KeyCardBlock
local KeyCard = game.workspace.KeyCard
local SoundFolder = game.workspace.SoundFolder

KeyCardBlock.thing.Touched:Connect(function()
    if Tool.Parent == game.StarterPack then
        local keycardcall = 'key card used'
        print (keycardcall)
        ---write function for whatever block is changed by this
    end

    if KeyCard.Parent == game.workspace
        local deny = 'Key card denied.'
        print (deny)
        SoundFolder.TemporarySound.Playing = true
        wait (3)
        SoundFolder.TemporarySound.Playing = false --Sound must be updated

    end
end)

I'm trying to make the computer check whether the keycard is in the StarterPack. It doesn't work when I walk right up to the key card machine and then the transparent 'thing' which should call the function.

0
Not exactly sure what you're trying to do. For better assistance and faster responses I recommend going into the scripting helpers discord server! l_diue 15 — 1mo

1 answer

Log in to vote
0
Answered by 29 days ago

I tried make it so it would check if you have the key card. It obviously didn't work.

Ad

Answer this question