Hello, I need to get the name of all the players online, make sure that if in the chat I have written the name of the player then it shows a print ("Hello" ..player.name)
Example:
if chatmsg == "PlayerNameHere" then
for index, playerName in ipairs(player) do
print("Player name: "..player.Name)
end
end
I need to do that if the message written in the chat is the name of any online player in my game then make a print with their name, how could i do that?
I need to do that if in the chat the name of the player who is online in my game is written then a print appears with the name of the player that has been written
For example:
chat â /PlayerName
output: print ("The player name is ..." .. player.Name)
local p = game.Players:FindFirstChild(tostring(chatmsg))
if p then
for index, playerName in ipairs(player) do
print("Player name: "..tostring(chatmsg))
end
end
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(message)
for i,Player2 in pairs(Players:GetPlayers()) do
if message == '/' .. Player2.Name then
print("The player name is ..." .. Player2.Name)
end
end
end)
end)