Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local showDialogResponse = ReplicatedStorage:WaitForChild("ShowDialogResponse")
- local gui = script.Parent
- local frame = gui:WaitForChild("Frame")
- local dialogueText = frame:WaitForChild("DialogueText")
- gui.Enabled = false
- -- Сколько секунд показывать реплику
- local RESPONSE_DURATION = 3
- -- Номер текущего сообщения.
- -- Нужен, чтобы старый таймер не закрыл новое сообщение.
- local messageId = 0
- --------------------------------------------------
- -- Получаем персональную реплику NPC
- --------------------------------------------------
- showDialogResponse.OnClientEvent:Connect(function(responseText)
- if typeof(responseText) ~= "string" then
- return
- end
- messageId += 1
- local thisMessageId = messageId
- dialogueText.Text = responseText
- gui.Enabled = true
- --------------------------------------------------
- -- Автоматическое скрытие
- --------------------------------------------------
- task.delay(RESPONSE_DURATION, function()
- if thisMessageId == messageId then
- gui.Enabled = false
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment