This is a chat activated door script that opens when you say a certain thing. I want to know if I'm able to make this only work if you're holding a certain tool. Is that possible.
door = script.Parent --this is the door
function onChatted(msg, recipient, speaker)
-- convert to all lower case
local source = string.lower(speaker.Name)
msg = string.lower(msg)
if (msg == "alohomora") then
door.CanCollide = false
door.Transparency = 0.7
wait(5)
door.CanCollide = true
door.Transparency = 0
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
