Menace00

Roblox Chat controller script

Jun 15th, 2023
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. --R15 required
  2. --type "/e chat <Username>" to chat for someone ;)
  3. --(use responsibly or roblox will get mad)
  4.  
  5. for i,lplr in pairs(game:GetService("Players"):GetPlayers()) do
  6. lplr.Character.Humanoid.DisplayName = lplr.DisplayName.."\n\@"..lplr.Name
  7. lplr.Character.Humanoid.NameDisplayDistance = math.huge
  8. lplr.CharacterAdded:Connect(function()
  9. lplr.Humanoid.Character:WaitForChild("Humanoid").DisplayName = lplr.DisplayName.."\n\@"..lplr.Name
  10. lplr.Character.Humanoid.NameDisplayDistance = math.huge
  11. end)
  12. end
  13.  
  14. game:GetService("Players").PlayerAdded:Connect(function(lplr)
  15. repeat
  16. wait()
  17. until lplr.Character ~= nil
  18. lplr.Character:WaitForChild("Humanoid").DisplayName = lplr.DisplayName.."\n\@"..lplr.Name
  19. lplr.Character.Humanoid.NameDisplayDistance = math.huge
  20. lplr.CharacterAdded:Connect(function()
  21. lplr.Character:WaitForChild("Humanoid").DisplayName = lplr.DisplayName.."\n\@"..lplr.Name
  22. lplr.Character.Humanoid.NameDisplayDistance = math.huge
  23. end)
  24. end)
  25.  
  26. players = game:GetService("Players")
  27. local_player = players.LocalPlayer
  28. character = local_player.Character
  29.  
  30. character.LowerTorso.Root:Destroy()
  31.  
  32.  
  33. frame = local_player.PlayerGui.Chat.Frame.ChatBarParentFrame.Frame.BoxFrame.Frame
  34.  
  35. chatbar = frame.ChatBar
  36.  
  37. autofill = frame.TextLabel:Clone()
  38. autofill.Name = "autofill"
  39. autofill.Parent = frame
  40. autofill.TextColor3 = Color3.fromRGB(62, 62, 62)
  41. autofill.Text = ""
  42. autofill.TextTransparency = 0.4
  43. autofill.Visible = true
  44.  
  45. victim = nil
  46.  
  47. chatbar:GetPropertyChangedSignal("Text"):Connect(function()
  48. local text = chatbar.Text
  49. if text:match("/e chat ") then do
  50. local remove_autofill = true
  51. local player_typed = string.gsub(text,"/e chat ",""):lower()
  52. for i,v in pairs(players:GetPlayers()) do
  53. if v.Name:sub(0,#player_typed):lower():match(player_typed) then
  54. autofill.Text = text..v.Name:sub(#player_typed+1,#v.Name)
  55. remove_autofill = false
  56. break
  57. end
  58. end
  59. if remove_autofill == true then
  60. autofill.Text = ""
  61. end
  62. end else
  63. autofill.Text = ""
  64. end
  65. end)
  66.  
  67. local_player.Chatted:Connect(function(chat)
  68. if chat:match("/e chat ") then
  69. local player_typed = string.gsub(chat,"/e chat ",""):lower()
  70. for i,v in pairs(players:GetPlayers()) do
  71. if v.Name:sub(0,#player_typed):lower():match(player_typed) then
  72. victim = v.Character
  73. break
  74. end
  75. end
  76. end
  77. end)
  78.  
  79. character.HumanoidRootPart.CanCollide = false
  80. while task.wait() do
  81. if victim ~= nil then
  82. character.HumanoidRootPart.CFrame = CFrame.new(victim.Head.CFrame.Position)
  83. end
  84. end
Add Comment
Please, Sign In to add comment