I have a door in my game, I've edited it to accept my name, so if I say open/door, it opens a door by making it noncancollide. This works well, and I probably could edit it, but I'd like a better understanding of how this function works so that I can find other ways to make it do what I want. Please help me understand this process of making an onchatted function do something when a key phrase is entered by the players specified.
COMMUNITY QUESTION
How do I use onchatted to make properties change in a brick?
1 answer
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg == "open" then
PATHTODOOR.CanCollide = false
elseif msg = "close" then
PATHTODOOR.CanCollide = true
else
print("not valid msg")
end
end)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
