Advertisement
Quoteory

Stand

Dec 8th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local RunService = game:GetService("RunService")
  3.  
  4. local character = script.Parent
  5. local standModel = ReplicatedStorage:WaitForChild("Stand")
  6.  
  7. local standOffset = CFrame.new(3, 1, 3)
  8.  
  9. local bodyPosTemplate = Instance.new("BodyPosition")
  10. bodyPosTemplate.D = 450
  11. bodyPosTemplate.MaxForce = Vector3.new(5000, 5000, 5000)
  12. bodyPosTemplate.P = 2000
  13.  
  14. local bodyGyroTemplate = Instance.new("BodyGyro")
  15. bodyGyroTemplate.MaxTorque = Vector3.new(10000, 10000, 10000)
  16. bodyGyroTemplate.D = 150
  17. bodyGyroTemplate.P = 4000
  18.  
  19. local newStand = standModel:Clone()
  20.        
  21. local standPrimary = newStand.PrimaryPart
  22. local characterPrimary = character.PrimaryPart
  23. local characterHumanoid = character.Humanoid
  24.        
  25. local newBodyPos = bodyPosTemplate:Clone()
  26. local newGyro = bodyGyroTemplate:Clone()
  27.        
  28. newGyro.Parent = standPrimary
  29. newBodyPos.Parent = standPrimary
  30.  
  31. newStand.Parent = workspace
  32.    
  33. local function updateForces()
  34.     local charCF = characterPrimary.CFrame
  35.     newGyro.CFrame = charCF
  36.     newBodyPos.Position = (charCF * standOffset).Position
  37. end
  38.        
  39.  
  40.        
  41. while true do
  42.     updateForces()
  43.     RunService.RenderStepped:Wait()
  44.     -- renderstepped really fast, using it prevents movement lag
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement