--I'm trying to learn how to detect if a player is saying a certain chat message while they're on a certain part. If ROBLOX detects that, then in the output, it will print "i". Here's the script:
local player = game.Players.LocalPlayer
player.Character.Chatted:connect(function(msg)
if msg=="I am me." then
for i,v in pairs(game.Workspace.Bathroom.Rug:GetTouchingParts()) do
if v.Parent == player.Character then
print("i")
break
end
end
end
end)
-- I know this doesn't work because the output doesn't print "i" and it says, "Workspace.I am me:3: attempt to index local 'player' (a nil value)". Could someone help?
