Hasli4

Untitled

Oct 4th, 2026
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3.  
  4. local player = Players.LocalPlayer
  5.  
  6. local prisonIntro =
  7. workspace:WaitForChild("PrisonIntro")
  8.  
  9. local guard =
  10. prisonIntro:WaitForChild("Guard")
  11.  
  12. local dialog =
  13. guard:WaitForChild("Head")
  14. :WaitForChild("Dialog")
  15.  
  16. local guardChoice =
  17. dialog:WaitForChild("GuardChoice")
  18.  
  19. local startGuardDeparture =
  20. ReplicatedStorage:WaitForChild(
  21. "StartGuardDeparture"
  22. )
  23.  
  24.  
  25. --------------------------------------------------
  26. -- Состояние
  27. --------------------------------------------------
  28.  
  29. local choiceAlreadySelected = false
  30.  
  31.  
  32. --------------------------------------------------
  33. -- Начальное состояние
  34. --------------------------------------------------
  35.  
  36. if dialog:GetAttribute("Ready") ~= true then
  37.  
  38. print(
  39. "[GUARD DIALOG] Guard ещё не готов"
  40. )
  41.  
  42. end
  43.  
  44.  
  45. --------------------------------------------------
  46. -- Следим за Ready
  47. --------------------------------------------------
  48.  
  49. dialog:GetAttributeChangedSignal(
  50. "Ready"
  51. ):Connect(function()
  52.  
  53. local ready =
  54. dialog:GetAttribute("Ready")
  55.  
  56.  
  57. if ready then
  58.  
  59. print(
  60. "[GUARD DIALOG] Guard готов к диалогу"
  61. )
  62.  
  63. choiceAlreadySelected = false
  64.  
  65. else
  66.  
  67. print(
  68. "[GUARD DIALOG] Диалог Guard закрыт"
  69. )
  70.  
  71. end
  72.  
  73. end)
  74.  
  75.  
  76. --------------------------------------------------
  77. -- DialogChoiceSelected
  78. --------------------------------------------------
  79.  
  80. dialog.DialogChoiceSelected:Connect(
  81. function(selectedPlayer, selectedChoice)
  82.  
  83. --------------------------------------------------
  84. -- Только текущий игрок
  85. --------------------------------------------------
  86.  
  87. if selectedPlayer ~= player then
  88. return
  89. end
  90.  
  91.  
  92. --------------------------------------------------
  93. -- Только наш GuardChoice
  94. --------------------------------------------------
  95.  
  96. if selectedChoice ~= guardChoice then
  97. return
  98. end
  99.  
  100.  
  101. --------------------------------------------------
  102. -- Guard должен быть готов
  103. --------------------------------------------------
  104.  
  105. if dialog:GetAttribute("Ready")
  106. ~= true then
  107.  
  108. print(
  109. "[GUARD DIALOG] Guard ещё не готов"
  110. )
  111.  
  112. return
  113.  
  114. end
  115.  
  116.  
  117. --------------------------------------------------
  118. -- Не отправляем выбор дважды
  119. --------------------------------------------------
  120.  
  121. if choiceAlreadySelected then
  122. return
  123. end
  124.  
  125.  
  126. choiceAlreadySelected = true
  127.  
  128.  
  129. print(
  130. "[GUARD DIALOG] GuardChoice выбран"
  131. )
  132.  
  133.  
  134. --------------------------------------------------
  135. -- Отправляем серверу
  136. --------------------------------------------------
  137.  
  138. startGuardDeparture:FireServer()
  139.  
  140. end
  141. )
Advertisement
Add Comment
Please, Sign In to add comment