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

NPCS that say random things when proximity prompt click?

Asked by 2 years ago

Hi

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

1 answer

Log in to vote
0
Answered by 2 years ago

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)
Ad

Answer this question