So, I have a code that checks if my tool touches my mesh object and it doesn’t seem to be working. I attempted to add some outputs to see if it gets an error, but still nothing logs in output. I will provide my code below in order for you to help assist me with this problem.
local KeycardHolder = script.Parent
local KeycardStatus = script.Parent.Parent.KeycardHolderStatus
local DoorPart = game.Workspace.Map.Door7
local TweenService = game:GetService("TweenService")
local OpenDoor = TweenService:Create(DoorPart, TweenInfo.new(3), {Position = Vector3.new(-36.938, 38.089, -66.858)})
local CloseDoor = TweenService:Create(DoorPart, TweenInfo.new(3), {Position = Vector3.new(-36.938, 23.007, -66.858)})
local OpenNoise = DoorPart["Open/CloseNoise"]
KeycardHolder.Touched:Connect(function(hit)
if hit.Parent.Name == "Clearance I" then
print("Success!")
OpenDoor:Play()
OpenNoise:Play()
wait(5)
CloseDoor:Play()
OpenNoise:Play()
else
print("Failure!")
end
end)
The keycard holder is a variable for the actual object that is being touched to activate the event. There is also nothing that is logged into the output.
What is the KeycardHolder variable? Is it a tool? If it’s a tool then your Touched event will never fire because tools don’t collide with anything, their Handles do.