In this Roblox Studio tutorial, I’ll show you how to make an NPC that talks and interacts when a player gets close or clicks on them! 💬
SCRIPT:
local Chat = game:GetService("Chat")
local prompt = script.Parent
local npc = prompt.Parent
local head = npc.Head
local dialougeArray = {"sup","you look familiar", "Nevermind Your Chopped"}
local dialougeIndex = 1
local function speak()
local dialogue = dialougeArray[dialougeIndex]
Chat:Chat(head, dialogue)
dialougeIndex += 1
end
prompt.Triggered:Connect(speak)