KillerDropz

mike

Apr 30th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function onChatted(msg, recipient, speaker)
  2.  
  3. local source = string.lower(speaker.Name)
  4. msg = string.lower(msg)
  5. local pos1 = script.Parent.Position
  6. local pos2 = speaker.Character.Head.Position
  7. dist=(pos1-pos2).magnitude
  8. dist=dist-math.max(math.max(speaker.Character.Head.Size.x, speaker.Character.Head.Size.z), speaker.Character.Head.Size.y)
  9. if (dist <= 5 and script.Parent.On.Value == true) then
  10. local m = Instance.new("Message")
  11. m.Parent = game.Workspace
  12. m.Text = msg
  13. wait(3)
  14. m:remove()
  15. end
  16.  
  17. end
  18.  
  19. function onPlayerEntered(newPlayer)
  20. newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
  21. end
  22.  
  23. game.Players.ChildAdded:connect(onPlayerEntered)
Add Comment
Please, Sign In to add comment