End_Wolf

Untitled

Jul 11th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. waittime = 5--Change this to the time that the overhead message will stay (Leave it to a low number because if someone chats a lot, you won't be able to read it)
  2.  
  3.  
  4. function onChatted(msg,recipient,speaker)
  5. if toWho(msg,speaker)~=false then
  6. players = game.Players:getChildren()
  7. for i=1, #players do
  8. --if players[i].SuperSafeChat==false then --SuperSafe is ON
  9. if(players[i].Name==glue[2].Name)then
  10. local char = players[i].Character
  11. if char:findFirstChild("chatMsg")~=nil then
  12. char:findFirstChild("chatMsg").Parent = nil
  13. end --Looks less confusing with text here...
  14.  
  15. local model = Instance.new("Model")
  16. local model2 = Instance.new("Model")
  17. local brick = Instance.new("Part")
  18. local humanoid = Instance.new("Humanoid")
  19. local weld = Instance.new("Weld")
  20. model2.Name = "chatMsg"
  21. model2.Parent = char
  22. model.Parent = model2
  23. brick.Parent = model
  24. brick.Position = char.Head.Position + Vector3.new(0,1,0)
  25. brick.Name = "Head"
  26. brick.Transparency = .98
  27. brick.formFactor = "Plate"
  28. brick.Size = Vector3.new(1,.4,1)
  29. brick.CanCollide = false
  30. brick.Locked = true
  31. humanoid.MaxHealth = 0
  32. humanoid.Parent = model
  33. weld.Parent = char.Head
  34. weld.Part1 = char.Head
  35. weld.Part0 = brick
  36. weld.C1 = CFrame.new(0,2,0)
  37. model.Name = (""..speaker.Name..": "..glue[1].."")
  38. wait(waittime)
  39. model2:Remove()
  40. end
  41. end
  42. end
  43. end
  44.  
  45. function toWho(msg,speaker)
  46. if (string.sub(msg,1,2) == "@/") then
  47. for pie = 3,50 do
  48. if string.sub(msg,pie,pie) == "/" then
  49. danumber = pie - 1
  50. break
  51. end
  52. end
  53. ick = string.sub(msg,3,danumber)
  54. ick2 = string.sub(msg,danumber + 2)
  55. char1 = nil
  56. local c = game.Players:GetChildren()
  57. for i=1,#c do
  58. h = c[i]
  59. if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
  60. if h.className == "Player" then
  61. char1 = h
  62. message = ick2
  63. glue={[1]=message,[2]=char1}
  64. return glue
  65. end
  66. else return false
  67. end
  68. end
  69. else
  70. return false
  71. end
  72. end
  73.  
  74. function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
  75. end
  76.  
  77. game.Players.ChildAdded:connect(onPlayerEntered)
Add Comment
Please, Sign In to add comment