Advertisement
RyanDaCoder

Name/

Sep 6th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. --[[
  2. To those scripting folk out there:
  3.  
  4. This puts a value in the player's character so the script can figure out what to do.
  5. It's a little bit pointless, but hey, it works.
  6.  
  7. From there, the script clones the head, puts it in a model inside the Character, welds it on,
  8. and renames it. Good to go.
  9.  
  10. -madscientist42
  11. ]]--
  12.  
  13. function onChatted(message, player)
  14. if message:sub(1, 5) == "Name/" or message:sub(1, 5) == "name/" then -- if first part of message is name/ then
  15. local hi = player.Character
  16. local humanoid = hi.Humanoid
  17. if hi:FindFirstChild("Custom") == nil then
  18. local val = Instance.new("BoolValue") -- add the semi-pointless value if it doesnt already exist.
  19. val.Name = "Custom"
  20. val.Parent = hi
  21. val.Value = false
  22. end
  23. local maybe = hi:FindFirstChild("Custom")
  24. if maybe ~= nil then
  25. if maybe.Value == true then
  26. local stoof = hi:GetChildren()
  27. for i = 1,#stoof do
  28. if stoof[i]:IsA("Model") then
  29. stoof[i].Name = (message:sub(6))
  30. end
  31. end
  32. end
  33. if maybe.Value == false then
  34. local c = humanoid.Parent.Head:Clone()
  35. local m = Instance.new("Model")
  36. local h = Instance.new("Humanoid")
  37. humanoid.Parent.Head.Transparency = 1 -- invisible your real head.
  38. h.Name = "Herpdederp" -- to eliminate the potential for zombie-like scripts to attack the fake head
  39. h.MaxHealth = 0
  40. h.Health = 0 -- no healthbar.
  41. m.Parent = hi
  42. h.Parent = m
  43. c.Parent = m
  44. m.Name = (message:sub(6)) -- set the name to whatever you said
  45. local weld = Instance.new("Weld") --weld the head on
  46. weld.Parent = humanoid.Parent.Head
  47. weld.Part0 = humanoid.Parent.Head
  48. weld.Part1 = c
  49. maybe.Value = true
  50. end
  51. end
  52. end
  53. end
  54. game.Players.PlayerAdded:connect(function(player)
  55. player.Chatted:connect(function(message) onChatted(message, player) end)
  56. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement