Hasli4

Untitled

Aug 31st, 2026
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2.  
  3. local showDialogResponse = ReplicatedStorage:WaitForChild("ShowDialogResponse")
  4.  
  5. local gui = script.Parent
  6. local frame = gui:WaitForChild("Frame")
  7. local dialogueText = frame:WaitForChild("DialogueText")
  8.  
  9. gui.Enabled = false
  10.  
  11. local messageId = 0
  12.  
  13. print("[RESPONSE GUI] LocalScript запустился")
  14.  
  15.  
  16. --------------------------------------------------
  17. -- Получаем ответ NPC
  18. --------------------------------------------------
  19.  
  20. showDialogResponse.OnClientEvent:Connect(function(responseText)
  21.  
  22. print("========================================")
  23. print("[RESPONSE GUI] Получен ответ NPC:")
  24. print(responseText)
  25. print("========================================")
  26.  
  27.  
  28. if typeof(responseText) ~= "string" then
  29.  
  30. warn("[RESPONSE GUI] Ответ не является строкой")
  31.  
  32. return
  33. end
  34.  
  35.  
  36. --------------------------------------------------
  37. -- Новый номер сообщения
  38. --------------------------------------------------
  39.  
  40. messageId += 1
  41.  
  42. local thisMessageId = messageId
  43.  
  44.  
  45. --------------------------------------------------
  46. -- Показываем сообщение
  47. --------------------------------------------------
  48.  
  49. dialogueText.Text = responseText
  50.  
  51. gui.Enabled = true
  52.  
  53.  
  54. print("[RESPONSE GUI] Окно ответа открыто")
  55.  
  56.  
  57. --------------------------------------------------
  58. -- Через 3 секунды скрываем
  59. --------------------------------------------------
  60.  
  61. task.delay(3, function()
  62.  
  63. if thisMessageId ~= messageId then
  64. return
  65. end
  66.  
  67. gui.Enabled = false
  68.  
  69. print("[RESPONSE GUI] Окно ответа скрыто")
  70.  
  71. end)
  72.  
  73. end)
Advertisement
Add Comment
Please, Sign In to add comment