Advertisement
oopsrainbow4

Basic NPC Chat

Jul 11th, 2022
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. local NPC = workspace.NPC
  2. local TA = NPC.TextActivator
  3. local player = game:GetService("Players").LocalPlayer
  4. local hum = player.Character:WaitForChild("Humanoid")
  5. local npcText = script.Parent.NPCTextFrame.NPCText
  6. local NPCTF = script.Parent.NPCTextFrame
  7.  
  8. local active = false
  9.  
  10. TA.Triggered:Connect(function()
  11.     if active == false then
  12.         NPCTF.Visible = true
  13.         hum.WalkSpeed = 0
  14.         local function typewrite(object, text, length)
  15.             for i = 1, #text, 1 do
  16.                 object.Text = string.sub(text,1,i)
  17.                 wait(length)
  18.             end
  19.         end
  20.         wait(1)
  21.         typewrite(npcText, "Have you notice why I'm here?", .01)
  22.         wait(2)
  23.         typewrite(npcText, "Because creator put me here and he know you gonna look at me.", .01)
  24.         wait(3)
  25.         typewrite(npcText, "...", .03)
  26.         wait(4)
  27.         typewrite(npcText, "I'm just NPC you know.", .01)
  28.         wait(5)
  29.         npcText.Text = " "
  30.         NPCTF.Visible = false
  31.         hum.WalkSpeed = 16
  32.         active = false
  33.     end
  34. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement