Advertisement
95audrey

cc

Mar 8th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1.  
  2. local RS = Game:GetService('ReplicatedStorage')
  3. local Players = Game:GetService('Players')
  4.  
  5. local Timer = require(RS.Timer)
  6. local Scheduler = require(RS.Scheduler)
  7. local CustomCharacter = require(RS.CustomCharacter)
  8. local CustomCharacterView = require(RS.CustomCharacterView)
  9.  
  10. local Player = Players.LocalPlayer
  11.  
  12. -- Keep this script running for the whole session
  13. Scheduler:FastWait()
  14. script.Parent = nil
  15. Game:GetService('StarterGui').ResetPlayerGuiOnSpawn = false
  16.  
  17. local PartsToHide = {['Head'] = true; ['Torso'] = true; ['Right Leg'] = true, ['Left Leg'] = true, ['Right Arm'] = true, ['Left Arm'] = true}
  18.  
  19. local function handleCharacter(player, character)
  20. -- Make the existing character invisible
  21. function handleChild(p)
  22. if p:IsA('BasePart') and PartsToHide[p.Name] then
  23. p.Transparency = 1
  24. end
  25. if p:IsA('Shirt') or p:IsA('Hat') then
  26. Spawn(function()
  27. p:Destroy()
  28. end)
  29. end
  30. if p.Name == 'Head' then
  31. for _, ch in pairs(p:GetChildren()) do
  32. if ch:IsA('Decal') then Spawn(function() ch:Destroy() end) end
  33. end
  34. end
  35. end
  36. for _, part in pairs(character:GetChildren()) do
  37. handleChild(part)
  38. end
  39. character.ChildAdded:connect(handleChild)
  40.  
  41. -- Create a view
  42. local customCharacter = CustomCharacter.CreateDefault(character)
  43. local customCharacterView = CustomCharacterView.Create(customCharacter, character)
  44.  
  45. -- Main loop
  46. local timer = Timer.Create()
  47. while character.Parent do
  48. local animateTimer = Timer.Create()
  49. customCharacterView:Update(timer:GetDelta())
  50. --print(string.format("%3.2fms", animateTimer:GetDelta()*1000))
  51. Scheduler:FastWait()
  52. end
  53. customCharacterView:Destroy()
  54. end
  55.  
  56. local function handlePlayer(player)
  57. if not player:IsA('Player') then return end
  58. player.CharacterAdded:connect(function(character)
  59. handleCharacter(player, character)
  60. end)
  61. if player.Character then
  62. Scheduler:FastSpawn(handleCharacter, player, player.Character)
  63. end
  64. end
  65.  
  66. Players.ChildAdded:connect(handlePlayer)
  67. for _, player in pairs(Players:GetChildren()) do
  68. if player:IsA('Player') then
  69. Scheduler:FastSpawn(handlePlayer, player)
  70. end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement