I created a script that would make an NPC reply to a specific message that I send via the chatbox. However, when I added the built-in function “player” into the message, it responded to me saying “Hello there (player)”. Here is what the script looks like:
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == "Hi!" then
game:GetService("Chat"):Chat(script.Parent.Head, "Hey there (player)", Enum.ChatColor.Blue)
end
end)
end)
player.Chatted:Connect(function(msg)
if msg == "Hi!" then
game:GetService("Chat"):Chat(script.Parent.Head, "Hey there " .. player.name, Enum.ChatColor.Blue)
end
end)
end)
first idk about the () inside “”
Because “” means text
to add text u need to do . .
then add somethind
second problem u did player not player.name