User: local ChatService = game:GetService("Chat")
local Players = game:GetService("Players")
local part = script.Parent

local TRIGGER_RADIUS = 20
local activePlayers = {}

local function similarity(a, b)
	a, b = a:lower(), b:lower()
	local same = 0
	for i = 1, math.min(#a, #b) do
		if a:sub(i, i) == b:sub(i, i) then
			same += 1
		end
	end
	return same / math.max(#a, #b)
end

local greetings = {
	Russian = {"привет", "здравствуй"},
	Indonesian = {"halo", "hai"},
	English = {"hello", "hi"},
	Japanese = {"こんにちは"},
	Korean = {"안녕하세요"},
	Mandarin = {"你好"},
	French = {"salut", "bonjour"},
}

local directionKeywords = {
	Russian = {"где", "направление", "как пройти"},
	Indonesian = {"arah", "di mana", "bagaimana menuju", "lokasi"},
	English = {"direction", "where is", "how to get", "location"},
	Japanese = {"どこ", "行き方", "場所"},
	Korean = {"어디", "가는 방법", "위치"},
	Mandarin = {"哪里", "怎么走", "位置"},
	French = {"où", "comment aller", "emplacement", "direction"},
}

local thankKeywords = {
	Russian = {"спасибо", "благодарю"},
	Indonesian = {"terima kasih", "makasih"},
	English = {"thank you", "thanks"},
	Japanese = {"ありがとう", "感謝"},
	Korean = {"감사합니다", "고마워"},
	Mandarin = {"谢谢", "多谢"},
	French = {"merci", "je vous remercie"},
}

local goodbyeKeywords = {
	Russian = {"до свидания", "пока"},
	Indonesian = {"selamat tinggal", "sampai jumpa"},
	English = {"goodbye", "bye", "see you"},
	Japanese = {"さようなら", "じゃあね"},
	Korean = {"안녕히 가세요", "잘 가"},
	Mandarin = {"再见", "回头见"},
	French = {"au revoir", "à bientôt"},
}

local greetingResponses = {
	Russian = "Привет тоже! Я могу вам помочь?",
	Indonesian = "halo juga! Ada yang bisa saya bantu?",
	English = "Hi there! How can I help you?",
	Japanese = "私もこんにちは！いかがなさいましたか ?",
	Korean = "안녕하세요! 내가 할 수 있는 모든 것 ?",
	Mandarin = "你好！我可以帮你吗 ?",
	French = "Salut aussi ! Puis-je vous aider?",
}

local apologyResponses = {
	Russian = "Извините, произошла ошибка.",
	Indonesian = "Maaf untuk informasi seperti ini, harap ke ruang denah museum",
	English = "Sorry for this information, please go to the museum map room",
	Japanese = "エラーが発生しました",
	Korean = "저희 팀에 오류가 발생했습니다.",
	Mandarin = "抱歉，我们遇到了错误",
	French = "Désolé, nous avons une erreur",
}

local directionResponses = {
	Russian = "Вы просто идете прямо по этой дороге, затем поверните налево на повороте, и вы пришли.",
	Indonesian = "Kamu hanya perlu lurus dari jalan ini lalu berbelok ke tikungan kiri dan Anda telah sampai.",
	English = "You just need to go straight down this road, then turn left at the corner and you've arrived.",
	Japanese = "この道をまっすぐ進んで、左の角を曲がると到着です。",
	Korean = "이 길을 곧장 가다가 왼쪽 모퉁이에서 돌면 도착합니다.",
	Mandarin = "你只需沿着这条路直走，然后在拐角处左转，你就到了。",
	French = "Vous n'avez qu'à aller tout droit sur cette route, puis tourner à gauche au coin et vous êtes arrivé.",
}

local thankResponses = {
	Russian = "Пожалуйста! Всегда рад помочь!",
	Indonesian = "Sama-sama! Senang bisa membantu!",
	English = "You're welcome! Happy to help!",
	Japanese = "どういたしまして！お役に立ててうれしいです！",
	Korean = "천만에요! 도움이 되어 기쁩니다!",
	Mandarin = "不客气！很高兴能帮上你！",
	French = "De rien ! Heureux d'avoir pu aider !",
}

local goodbyeResponses = {
	Russian = "До свидания! Удачи!",
	Indonesian = "Sampai jumpa! Semoga harimu menyenangkan!",
	English = "Goodbye! Have a great day!",
	Japanese = "さようなら！良い一日を！",
	Korean = "안녕히 가세요! 좋은 하루 되세요!",
	Mandarin = "再见！祝你有美好的一天！",
	French = "Au revoir ! Passez une bonne journée !",
}

local function detectLanguage(message)
	local scores = {
		Russian = 0,
		Indonesian = 0,
		English = 0,
		Japanese = 0,
		Korean = 0,
		Mandarin = 0,
		French = 0,
	}

	for lang, keywords in pairs(greetings) do
		for _, keyword in ipairs(keywords) do
			if similarity(message, keyword) > 0.7 then
				scores[lang] += 1
			end
		end
	end

	local maxLang, maxScore = "English", 0
	for lang, score in pairs(scores) do
		if score > maxScore then
			maxLang = lang
			maxScore = score
		end
	end

	return maxLang
end

local function containsKeywords(message, keywordSet, language)
	for _, keyword in ipairs(keywordSet[language] or {}) do
		if similarity(message, keyword) > 0.7 then
			return true
		end
	end
	return false
end

-- Loop untuk memantau radius dan update activePlayers
task.spawn(function()
	while true do
		for _, player in ipairs(Players:GetPlayers()) do
			if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
				local dist = (player.Character.HumanoidRootPart.Position - part.Position).Magnitude
				if dist <= TRIGGER_RADIUS then
					activePlayers[player] = true
				else
					activePlayers[player] = nil -- Reset saat keluar
				end
			end
		end
		task.wait(1)
	end
end)

-- Respon ketika pemain mengirim pesan
Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if not activePlayers[player] then return end

		local language = detectLanguage(msg)

		local matchedGreeting = false
		for _, keyword in ipairs(greetings[language]) do
			if similarity(msg, keyword) > 0.7 then
				matchedGreeting = true
				break
			end
		end

		if matchedGreeting then
			ChatService:Chat(part, greetingResponses[language], Enum.ChatColor.Blue)
		elseif containsKeywords(msg, directionKeywords, language) then
			ChatService:Chat(part, directionResponses[language], Enum.ChatColor.Blue)
		elseif containsKeywords(msg, thankKeywords, language) then
			ChatService:Chat(part, thankResponses[language], Enum.ChatColor.Green)
		elseif containsKeywords(msg, goodbyeKeywords, language) then
			ChatService:Chat(part, goodbyeResponses[language], Enum.ChatColor.Blue)
		else
			ChatService:Chat(part, apologyResponses[language], Enum.ChatColor.Red)
		end
	end)
end)

Mengapa pada saat saya mengirimkan chat yang berisi kata kunci di mana, lokasi, arah, part merespon dengan "Sorry, for information like this please go to museum map room"
User: local ChatService = game:GetService("Chat")
local Players = game:GetService("Players")
local part = script.Parent

local TRIGGER_RADIUS = 20
local activePlayers = {}

local function similarity(a, b)
	a, b = a:lower(), b:lower()
	local same = 0
	for i = 1, math.min(#a, #b) do
		if a:sub(i, i) == b:sub(i, i) then
			same += 1
		end
	end
	return same / math.max(#a, #b)
end

local greetings = {
	Russian = {"привет", "здравствуй"},
	Indonesian = {"halo", "hai"},
	English = {"hello", "hi"},
	Japanese = {"こんにちは"},
	Korean = {"안녕하세요"},
	Mandarin = {"你好"},
	French = {"salut", "bonjour"},
}

local directionKeywords = {
	Russian = {"где", "направление", "как пройти"},
	Indonesian = {"arah", "di mana", "bagaimana menuju", "lokasi"},
	English = {"direction", "where is", "how to get", "location"},
	Japanese = {"どこ", "行き方", "場所"},
	Korean = {"어디", "가는 방법", "위치"},
	Mandarin = {"哪里", "怎么走", "位置"},
	French = {"où", "comment aller", "emplacement", "direction"},
}

local thankKeywords = {
	Russian = {"спасибо", "благодарю"},
	Indonesian = {"terima kasih", "makasih"},
	English = {"thank you", "thanks"},
	Japanese = {"ありがとう", "感謝"},
	Korean = {"감사합니다", "고마워"},
	Mandarin = {"谢谢", "多谢"},
	French = {"merci", "je vous remercie"},
}

local goodbyeKeywords = {
	Russian = {"до свидания", "пока"},
	Indonesian = {"selamat tinggal", "sampai jumpa"},
	English = {"goodbye", "bye", "see you"},
	Japanese = {"さようなら", "じゃあね"},
	Korean = {"안녕히 가세요", "잘 가"},
	Mandarin = {"再见", "回头见"},
	French = {"au revoir", "à bientôt"},
}

local greetingResponses = {
	Russian = "Привет тоже! Я могу вам помочь?",
	Indonesian = "halo juga! Ada yang bisa saya bantu?",
	English = "Hi there! How can I help you?",
	Japanese = "私もこんにちは！いかがなさいましたか ?",
	Korean = "안녕하세요! 내가 할 수 있는 모든 것 ?",
	Mandarin = "你好！我可以帮你吗 ?",
	French = "Salut aussi ! Puis-je vous aider?",
}

local apologyResponses = {
	Russian = "Извините, произошла ошибка.",
	Indonesian = "Maaf untuk informasi seperti ini, harap ke ruang denah museum",
	English = "Sorry for this information, please go to the museum map room",
	Japanese = "エラーが発生しました",
	Korean = "저희 팀에 오류가 발생했습니다.",
	Mandarin = "抱歉，我们遇到了错误",
	French = "Désolé, nous avons une erreur",
}

local directionResponses = {
	Russian = "Вы просто идете прямо по этой дороге, затем поверните налево на повороте, и вы пришли.",
	Indonesian = "Kamu hanya perlu lurus dari jalan ini lalu berbelok ke tikungan kiri dan Anda telah sampai.",
	English = "You just need to go straight down this road, then turn left at the corner and you've arrived.",
	Japanese = "この道をまっすぐ進んで、左の角を曲がると到着です。",
	Korean = "이 길을 곧장 가다가 왼쪽 모퉁이에서 돌면 도착합니다.",
	Mandarin = "你只需沿着这条路直走，然后在拐角处左转，你就到了。",
	French = "Vous n'avez qu'à aller tout droit sur cette route, puis tourner à gauche au coin et vous êtes arrivé.",
}

local thankResponses = {
	Russian = "Пожалуйста! Всегда рад помочь!",
	Indonesian = "Sama-sama! Senang bisa membantu!",
	English = "You're welcome! Happy to help!",
	Japanese = "どういたしまして！お役に立ててうれしいです！",
	Korean = "천만에요! 도움이 되어 기쁩니다!",
	Mandarin = "不客气！很高兴能帮上你！",
	French = "De rien ! Heureux d'avoir pu aider !",
}

local goodbyeResponses = {
	Russian = "До свидания! Удачи!",
	Indonesian = "Sampai jumpa! Semoga harimu menyenangkan!",
	English = "Goodbye! Have a great day!",
	Japanese = "さようなら！良い一日を！",
	Korean = "안녕히 가세요! 좋은 하루 되세요!",
	Mandarin = "再见！祝你有美好的一天！",
	French = "Au revoir ! Passez une bonne journée !",
}

local function detectLanguage(message)
	local scores = {
		Russian = 0,
		Indonesian = 0,
		English = 0,
		Japanese = 0,
		Korean = 0,
		Mandarin = 0,
		French = 0,
	}

	for lang, keywords in pairs(greetings) do
		for _, keyword in ipairs(keywords) do
			if similarity(message, keyword) > 0.7 then
				scores[lang] += 1
			end
		end
	end

	local maxLang, maxScore = "English", 0
	for lang, score in pairs(scores) do
		if score > maxScore then
			maxLang = lang
			maxScore = score
		end
	end

	return maxLang
end

local function containsKeywords(message, keywordSet, language)
	for _, keyword in ipairs(keywordSet[language] or {}) do
		if similarity(message, keyword) > 0.7 then
			return true
		end
	end
	return false
end

-- Loop untuk memantau radius dan update activePlayers
task.spawn(function()
	while true do
		for _, player in ipairs(Players:GetPlayers()) do
			if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
				local dist = (player.Character.HumanoidRootPart.Position - part.Position).Magnitude
				if dist <= TRIGGER_RADIUS then
					activePlayers[player] = true
				else
					activePlayers[player] = nil -- Reset saat keluar
				end
			end
		end
		task.wait(1)
	end
end)

-- Respon ketika pemain mengirim pesan
Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if not activePlayers[player] then return end

		local language = detectLanguage(msg)

		local matchedGreeting = false
		for _, keyword in ipairs(greetings[language]) do
			if similarity(msg, keyword) > 0.7 then
				matchedGreeting = true
				break
			end
		end

		if matchedGreeting then
			ChatService:Chat(part, greetingResponses[language], Enum.ChatColor.Blue)
		elseif containsKeywords(msg, directionKeywords, language) then
			ChatService:Chat(part, directionResponses[language], Enum.ChatColor.Blue)
		elseif containsKeywords(msg, thankKeywords, language) then
			ChatService:Chat(part, thankResponses[language], Enum.ChatColor.Green)
		elseif containsKeywords(msg, goodbyeKeywords, language) then
			ChatService:Chat(part, goodbyeResponses[language], Enum.ChatColor.Blue)
		else
			ChatService:Chat(part, apologyResponses[language], Enum.ChatColor.Red)
		end
	end)
end)

Mengapa pada saat saya mengirimkan chat yang berisi kata kunci di mana, lokasi, arah, part merespon dengan "Sorry, for information like this please go to museum map room"
Assistant: