Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make an NPC talk?

Asked by
dreamy67 135
9 years ago

I want to make an NPC talk without any dialog choices. I've already got the walking down but I don't know how to make him talk by itself. I don't want you to have to click on a question mark above its head, I just want to to go ahead and say a few sentences in sequence. What is the best way to do this? I have already tried messing with dialog but I still can't figure it out.

2 answers

Log in to vote
2
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

ROBLOX has a Chat service, that allows to "simulate speech" without necessarily doing so via Dialog. It's pretty self-explanatory, so here's an idea of what the function call you need to make looks like, along with the parameters and their classNames.

Chat ( Instance partOrCharacter, string message, ChatColor color = Blue )

More on this service and its methods here

0
Thank you dreamy67 135 — 9y
0
Yup ImageLabel 1541 — 9y
0
Thx ANE_bot 17 — 4y
Ad
Log in to vote
2
Answered by
davness 376 Moderation Voter
9 years ago

As i know, you need to get Chat service.

to make the npc talking some sentences without any action from character, you need to get that service:

local chat = game:GetService("Chat")
local head = script.Parent.Head

while true do
chat:Chat(head, "I'm talking, can anyone hear me?", "Red")
wait(3)
chat:Chat(head, "Hello?", "Red")
wait(3)
chat:Chat(head, "OMG, I will destroy you!!!", "Red") -- you can change the color, just type it's name
end

Answer this question