SHARE
TWEET

Untitled

a guest Jun 12th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Boatbomber
  2.  
  3. --Services
  4. local RunService        = game:GetService('RunService')
  5. local UserInputService  = game:GetService("UserInputService")
  6.  
  7. --Localize
  8. local instance,newRay   = Instance.new,Ray.new
  9. local v2,v3,cf,udim2    = Vector2.new,Vector3.new,CFrame.new,UDim2.new
  10. local insert,random,abs = table.insert,math.random,math.abs
  11.  
  12.  
  13. local Player            = game.Players.LocalPlayer
  14. local Character         = Player.Character or Player.CharacterAdded:Wait()
  15.  
  16.  
  17. --Basic setup
  18. local ViewPort          = script.Parent
  19.  
  20. --Settings
  21. local Offset            = cf(0,1,-6)
  22.  
  23. --Create the viewport camera
  24. local Camera        = instance("Camera")
  25.     ViewPort.CurrentCamera  = Camera
  26.  
  27.  
  28.  
  29. local function RenderHumanoid(Model, Parent, MainModel)
  30.     local ModelParts = Model:GetDescendants()
  31.     for i=1, #ModelParts do
  32.         local Part      = ModelParts[i]
  33.         if not Part:IsA("Script")  then
  34.             local a         = Part.Archivable
  35.                 Part.Archivable = true
  36.                
  37.            
  38.             local RenderClone   = Part:Clone()
  39.                 Part.Archivable = a
  40.        
  41.             if Part:IsA("MeshPart") or Part:IsA("Part") then
  42.                 PartUpdater = RunService.Heartbeat:Connect(function()
  43.                     if Part then
  44.                         RenderClone.CFrame = Part.CFrame
  45.                     else
  46.                         RenderClone:Destroy()
  47.                         PartUpdater:Disconnect()
  48.                     end
  49.                 end)
  50.             elseif Part:IsA("Accoutrement") then
  51.                 PartUpdater = RunService.Heartbeat:Connect(function()
  52.                     if Part then
  53.                         if RenderClone.Handle then
  54.                             RenderClone.Handle.CFrame = Part.Handle.CFrame
  55.                         end
  56.                     else
  57.                         RenderClone:Destroy()
  58.                         PartUpdater:Disconnect()
  59.                     end
  60.                 end)
  61.             elseif Part:IsA("Script") then
  62.                 RenderClone:Destroy()
  63.             end
  64.                 RenderClone.Parent = Parent
  65.         end
  66.     end
  67. end
  68.  
  69.  
  70. --Let the world load before starting
  71. wait(1)
  72.  
  73.  
  74. local function Render()
  75.     ViewPort:ClearAllChildren()
  76.     --Render the character
  77.     local Char = instance("Model")
  78.         Char.Name = ""
  79.         Char.Parent = ViewPort
  80.     RenderHumanoid(Character,Char)
  81. end
  82.  
  83. --Handle changes
  84. Character.DescendantAdded:Connect(Render)
  85. Character.DescendantRemoving:Connect(Render)
  86.  
  87. --Initialize
  88. Render()
  89.  
  90. CameraUpdater = RunService.Heartbeat:Connect(function()
  91.     if Character.HumanoidRootPart then
  92.         Camera.CFrame =  cf(Character.HumanoidRootPart.CFrame:toWorldSpace(Offset).p, Character.HumanoidRootPart.CFrame.p)
  93.     end
  94. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top