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 4 years ago
Edited 4 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.

01local KeyCardBlock = game.workspace.KeyCardBlock
02local KeyCard = game.workspace.KeyCard
03local SoundFolder = game.workspace.SoundFolder
04 
05KeyCardBlock.thing.Touched:Connect(function()
06    if Tool.Parent == game.StarterPack then
07        local keycardcall = 'key card used'
08        print (keycardcall)
09        ---write function for whatever block is changed by this
10    end
11 
12    if KeyCard.Parent == game.workspace
13        local deny = 'Key card denied.'
14        print (deny)
15        SoundFolder.TemporarySound.Playing = true
16        wait (3)
17        SoundFolder.TemporarySound.Playing = false --Sound must be updated
18 
19    end
20end)

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 — 4y

1 answer

Log in to vote
0
Answered by 4 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