Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. local m = Create("Model"){
  2. Parent = Character,
  3. Name = "WeaponModel",
  4. }
  5.  
  6. local newMotor = function(part0, part1, c0, c1)
  7. local w = Create('Motor'){
  8. Parent = part0,
  9. Part0 = part0,
  10. Part1 = part1,
  11. C0 = c0,
  12. C1 = c1,
  13. }
  14. return w
  15. end
  16.  
  17. function clerp(a, b, t)
  18. return a:lerp(b, t)
  19. end
  20.  
  21. RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  22. NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  23.  
  24. local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
  25. local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
  26. local RH = newMotor(Torso, RightLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0))
  27. local LH = newMotor(Torso, LeftLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0))
  28. RootJoint.C1 = CFrame.new(0, 0, 0)
  29. RootJoint.C0 = CFrame.new(0, 0, 0)
  30. Torso.Neck.C1 = CFrame.new(0, 0, 0)
  31. Torso.Neck.C0 = CFrame.new(0, 1.5, 0)
  32.  
  33. local rarmc1 = RW.C1
  34. local larmc1 = LW.C1
  35. local rlegc1 = RH.C1
  36. local llegc1 = LH.C1
  37.  
  38. local resetc1 = false
  39.  
  40. function PlayAnimationFromTable(table, speed, bool)
  41. RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
  42. Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
  43. RW.C0 = clerp(RW.C0, table[3], speed)
  44. LW.C0 = clerp(LW.C0, table[4], speed)
  45. RH.C0 = clerp(RH.C0, table[5], speed)
  46. LH.C0 = clerp(LH.C0, table[6], speed)
  47. if bool == true then
  48. if resetc1 == false then
  49. resetc1 = true
  50. RootJoint.C1 = RootJoint.C1
  51. Torso.Neck.C1 = Torso.Neck.C1
  52. RW.C1 = rarmc1
  53. LW.C1 = larmc1
  54. RH.C1 = rlegc1
  55. LH.C1 = llegc1
  56. end
  57. end
  58. end
  59.  
  60. ArtificialHB = Create("BindableEvent", script){
  61. Parent = script,
  62. Name = "Heartbeat",
  63. }
  64.  
  65. script:WaitForChild("Heartbeat")
  66.  
  67. frame = 1 / 35
  68. tf = 0
  69. allowframeloss = false
  70. tossremainder = false
  71. lastframe = tick()
  72. script.Heartbeat:Fire()
  73.  
  74. game:GetService("RunService").Heartbeat:connect(function(s, p)
  75. tf = tf + s
  76. if tf >= frame then
  77. if allowframeloss then
  78. script.Heartbeat:Fire()
  79. lastframe = tick()
  80. else
  81. for i = 1, math.floor(tf / frame) do
  82. script.Heartbeat:Fire()
  83. end
  84. lastframe = tick()
  85. end
  86. if tossremainder then
  87. tf = 0
  88. else
  89. tf = tf - frame * math.floor(tf / frame)
  90. end
  91. end
  92. end)
  93.  
  94. function swait(num)
  95. if num == 0 or num == nil then
  96. ArtificialHB.Event:wait()
  97. else
  98. for i = 0, num do
  99. ArtificialHB.Event:wait()
  100. end
  101. end
  102. end
  103.  
  104. function RemoveOutlines(part)
  105. part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
  106. end
  107.  
  108. CFuncs = {
  109. Part = {
  110. Create = function(Parent, Material, Reflectance, Transparency, BColor, Name, Size)
  111. local Part = Create("Part"){
  112. Parent = Parent,
  113. Reflectance = Reflectance,
  114. Transparency = Transparency,
  115. CanCollide = false,
  116. Locked = true,
  117. BrickColor = BrickColor.new(tostring(BColor)),
  118. Name = Name,
  119. Size = Size,
  120. Material = Material,
  121. }
  122. RemoveOutlines(Part)
  123. return Part
  124. end;
  125. };
  126.  
  127. Mesh = {
  128. Create = function(Mesh, Part, MeshType, MeshId, OffSet, Scale)
  129. local Msh = Create(Mesh){
  130. Parent = Part,
  131. Offset = OffSet,
  132. Scale = Scale,
  133. }
  134. if Mesh == "SpecialMesh" then
  135. Msh.MeshType = MeshType
  136. Msh.MeshId = MeshId
  137. end
  138. return Msh
  139. end;
  140. };
  141.  
  142. Weld = {
  143. Create = function(Parent, Part0, Part1, C0, C1)
  144. local Weld = Create("Weld"){
  145. Parent = Parent,
  146. Part0 = Part0,
  147. Part1 = Part1,
  148. C0 = C0,
  149. C1 = C1,
  150. }
  151. return Weld
  152. end
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement