So I'm making a quiz I was wondering how I could make it so that when I say the door's name it would open instead of going into the script to edit the message every time. Here's the script:
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 == "hi") 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)
I tried using door.Name instead of "hi" but it didn't work. Help? Thanks.

2 comments
If the door's name has a capital letter, then you'll want to make the name lowercase in the script when comparing strings, since you have msg in all lowercase letters. Otherwise, I don't see your problem.
Show how you'd add door.Name to your script.