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

Keycard Not being detected by BasePart.Touched event, why is this so? [SOLVED]

Asked by 3 years ago
Edited 3 years ago

EDIT: Issue found, the script I used to give the player the keycard did not replicate to server, therefore it wasn't able to be detected.

Hey, I'm having an issue. so there is a grey part that is a scanner to override a door lockdown, however it isn't registering a keycard when the keycard touches it with a .Touched event.

If my player touches it, then its fine. If the keycard touches it, nothing happens. Anybody have any ideas why this is happening?

I used print(hit) with the part.Touched:Connect(function(hit) line to figure out what it was detecting, and the keycard isn't showing up when touched, only "RightHand", "RightLowerArm" and such are being printed when I bump into it)

script.Parent.OverrideDetector.Touched:Connect(function(hit) -- Everything below here does not run on touch from keycard, and when a print(hit) is put here the Keycard never shows up
if hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil then
        if not db then
             if hit.Parent.Parent:FindFirstChild("BoDKeycard") then
                wait(2.5)       
                db = true
                ts:Create(doorL, tInfo, doorLgoal):Play()
                ts:Create(doorR, tInfo, doorRgoal):Play()
                wait(5.7)
                ts:Create(doorL, tInfo, doorLpos):Play()
                ts:Create(doorR, tInfo, doorRpos):Play()
                db = false
            end     
        end
    end
end)
0
You have to show the script, otherwise we won't be able to fix it User#32819 0 — 3y
0
Could you take a screenshot or something like that of the keycard hierarchy? or maybe print the "hit" argument and check if the Parent of the Parent of the hit part is the keycard model? User#32819 0 — 3y

Answer this question