Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make a script do something when player is mentioned?

So I made this but dont thing it will work, as it mentions the local players name (i think)

	game.Players.PlayerAdded:connect(function(player)
	    local rank = player:GetRankInGroup(4813682)
	        player.Chatted:connect(function(msg)
	            if msg:lower() == "!pass "..player.Name then
				if rank >= 9 then print(nil)
				end

	            end
	        end)
	    end)

1 comment

0

do you want when you a player chats !PlayerName and that will do something?

1 answer

do like this:

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		local playerName  =  msg:match("!pass ([%w_]+)");
		if(playerName) then
			print("Player mentioned "..playerName)
		end
	end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.