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

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

Asked by 3 years ago
Edited 3 years 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 30 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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

Ad

Answer this question