Advertisement
HowToRoblox

VPFHandler

Feb 24th, 2021
4,856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local vpf = script.Parent:WaitForChild("CharacterVPF")
  2.  
  3. local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
  4. char.Archivable = true
  5.  
  6.  
  7. local cam = Instance.new("Camera")
  8. cam.Parent = vpf
  9.  
  10. vpf.CurrentCamera = cam
  11.  
  12.  
  13. local clonedChar
  14.  
  15.  
  16. game:GetService("RunService").RenderStepped:Connect(function()
  17.    
  18.    
  19.     if clonedChar then clonedChar:Destroy() end
  20.    
  21.    
  22.     clonedChar = char:Clone()
  23.    
  24.     local hrp = clonedChar:WaitForChild("HumanoidRootPart")
  25.    
  26.     cam.CFrame = CFrame.new(hrp.Position + (hrp.CFrame.LookVector * 5), hrp.Position)
  27.    
  28.     clonedChar.Parent = vpf
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement