Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

NPCS that say random things when proximity prompt click?

Hi

How do I make an npc say something random when proximity prompt click?

1 answer

Using Roblox's build in Chat method should do the trick!

Something like this:

local messages = {"Me-wow! Is that the latest felinor fashion?", "Hey hivekin can I bug you for a moment?"} -- we do a lil' trolling
local prompt = script.Parent.ProximityPrompt -- change to whatever your prompt is
local npc = script.Parent -- change to whatever your npc is
local chat = game:GetService("Chat")

prompt.Triggered:Connect(function()
	local index = math.round(math.random(1, #messages));
	local selected_message = messages[index]
	chat:Chat(npc.Head, selected_message, Enum.ChatColor.White)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.