Hasli4

Untitled

Aug 30th, 2026
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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. -- Сколько секунд показывать реплику
  12. local RESPONSE_DURATION = 3
  13.  
  14. -- Номер текущего сообщения.
  15. -- Нужен, чтобы старый таймер не закрыл новое сообщение.
  16. local messageId = 0
  17.  
  18.  
  19. --------------------------------------------------
  20. -- Получаем персональную реплику NPC
  21. --------------------------------------------------
  22.  
  23. showDialogResponse.OnClientEvent:Connect(function(responseText)
  24.  
  25. if typeof(responseText) ~= "string" then
  26. return
  27. end
  28.  
  29. messageId += 1
  30.  
  31. local thisMessageId = messageId
  32.  
  33. dialogueText.Text = responseText
  34.  
  35. gui.Enabled = true
  36.  
  37.  
  38. --------------------------------------------------
  39. -- Автоматическое скрытие
  40. --------------------------------------------------
  41.  
  42. task.delay(RESPONSE_DURATION, function()
  43.  
  44. if thisMessageId == messageId then
  45. gui.Enabled = false
  46. end
  47.  
  48. end)
  49.  
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment