o1-mini-2024-09-12· OpenAI WildChat-4.8M (AI2)
make a roblox script that i can put inside of an npc so if the player is in a 10 stud…
- User
make a roblox script that i can put inside of an npc so if the player is in a 10 stud radius it will say "hello!" and if the player says something like "hi" or "hello" back they will say "hi" again, now make a bunch of responses for the player, and the ai so like you could add something like "how are you?" and the ai would say "im good" and just keep making responses, also have no context or messages in the script or the message that you make providing the script
- Assistant
local npc = script.Parent local chatService = game:GetService("Chat") local Players = game:GetService("Players") local responses = { ["hi"] = "Hi!", ["hello"] = "Hello!", ["how are you"] = "I'm good!", ["what's up"] = "Not much, you?", ["goodbye"] = "Goodbye!", ["help"] = "How can I assist you?", ["thanks"] = "You're welcome!", ["bye"] = "See you later!", ["nice to meet you"] = "Nice to meet you too!", ["what is your name"] = "I'm an NPC." } local function greetPlayer(player) chatService:Chat(npc, "Hello!", Enum.ChatColor.Blue) local function onChatted(message) message = message:lower() if responses[message] then chatService:Chat(npc, responses[message], Enum.ChatColor.Blue) end end player.Chatted:Connect(onChatted) end local function checkProximity() for _, player in ipairs(Players:GetPlayers()) do if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then local distance = (npc.Position - player.Character.HumanoidRootPart.Position).Magnitude if distance <= 10 then greetPlayer(player) end end end end while wait(1) do checkProximity() end