Advertisement
BobMe

TextChat

Jan 20th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. do
  2. local filteredMessages = { ['___'] = '___' };
  3. local onPropertyChanged = function (obj)
  4. if (obj:isDescendantOf (workspace)) then
  5. local objText = obj.Text;
  6.  
  7. if (objText ~= '___' and objText:find '(%S)') then
  8. if (filteredMessages [objText] and filteredMessages [objText] ~= objText) then
  9. obj.Text = filteredMessages [objText];
  10. elseif (not filteredMessages [objText]) then
  11. obj.Text = '___';
  12.  
  13. local filtered = game:service 'Chat':FilterStringForBroadcast (objText, game:service 'Players'.localPlayer);
  14.  
  15. filteredMessages [objText] = filtered;
  16. filteredMessages [filtered] = filtered;
  17.  
  18. obj.Text = filtered;
  19. end;
  20. end;
  21. end;
  22. end;
  23.  
  24. local newInstance = Instance.new;
  25. Instance = {
  26. new = function (class, parent)
  27. local obj = newInstance (class, parent);
  28.  
  29. if (pcall (function()return obj.Text;end)) then
  30. obj:getPropertyChangedSignal ('Parent'):connect (function () onPropertyChanged (obj) end);
  31. obj:getPropertyChangedSignal ('Text'):connect (function() onPropertyChanged (obj) end);
  32. end;
  33.  
  34. return obj;
  35. end;
  36. };
  37. end;
  38. local plr = game.Players.LocalPlayer
  39. base = Instance.new("ScreenGui",plr.PlayerGui)
  40. bbg = Instance.new("BillboardGui",plr.Character.Head)
  41. bbg.Size = UDim2.new(0,200,0,50)
  42. bbg.StudsOffset = Vector3.new(0,2,0)
  43. bbgTl = Instance.new("TextLabel",bbg)
  44. bbgTl.BackgroundTransparency = 1
  45. bbgTl.Size = UDim2.new(10,0,1,0)
  46. bbgTl.Position = UDim2.new(-4.5,-3,0,0)
  47. bbgTl.Font = "SourceSansBold"
  48. bbgTl.Text = " "
  49. bbgTl.TextSize = 38
  50. bbgTl.TextStrokeColor3 = Color3.new(1,0,1)
  51. bbgTl.TextColor3 = Color3.new(1,1,1)
  52. bbgTl.TextStrokeTransparency = 0
  53. bbgTl.TextWrapped = true
  54. plr.Chatted:connect(function(msg)
  55. bbgTl.Text = msg
  56. wait(9)
  57. if bbgTl.Text == msg then
  58. bbgTl.Text = " "
  59. end
  60. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement