How to display Text from a table?

Hello!

I Am trying to achieve an NPC chatting a random text in a table, however. It only chats 1,2,3 ect. How can i fix this?

Code:

local ChatMessages = {"Great Story", "Your gonna make it big!", "That was so interesting!", "Teach me!"}

game:GetService("Chat"):Chat(friend.Head, math.random(1, #ChatMessages), Enum.ChatColor.Blue)

Can anyone help?

1 Like
local ChatMessages = {"Great Story", "Your gonna make it big!", "That was so interesting!", "Teach me!"}

game:GetService("Chat"):Chat(friend.Head, ChatMessages[math.random(1, #ChatMessages)], Enum.ChatColor.Blue)
1 Like

Thank you so much :smiley:

Appreciate it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.