Bro, First of all you need to put debounce
debounce = false
local part = script.Parent
part.Touched:Connect(function(hit)
if not debounce then
debounce = true
print("Door Touched!")
if hit.Name == "Key" then
print("Door Opened!")
end
wait(1)
debounce = false
end
end
Second of all, are your tool named "Key"? because tool is not a part, you need to change the script or it wont work.
debounce = false
local part = script.Parent
part.Touched:Connect(function(hit)
if not debounce then
debounce = true
print("Door Touched!")
if hit.Parent.Name == "Key" and hit.Parent.ClassName == "Tool" then
print("Door Opened!")
end
wait(1)
debounce = false
end
end
See the difference? the tool is not a part, but you can get the tool by the part, Using the part parent to detect if the parent is a tool, if it worked please mark this as an "Answer" and lock the thread (idk if it locks when u mark a "Anwer".
2 comments
Turns out I made a dumb mistake :/
sad