Dark_EccentricYT

Untitled

Mar 25th, 2017
4,436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.02 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3.  
  4. local Player = Players.LocalPlayer
  5. local Camera = workspace.CurrentCamera
  6. local Mouse = Player:GetMouse()
  7. local Camera = workspace.CurrentCamera
  8. local Character = Player.Character
  9. local Humanoid = Character:FindFirstChild("Humanoid")
  10. local Head = Character:FindFirstChild("Head")
  11. local Torso = Character:FindFirstChild("Torso")
  12. local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
  13. local RightArm = Character:FindFirstChild("Right Arm")
  14. local LeftArm = Character:FindFirstChild("Left Arm")
  15. local RightLeg = Character:FindFirstChild("Right Leg")
  16. local LeftLeg = Character:FindFirstChild("Left Leg")
  17.  
  18.  
  19.  
  20. local Funcs = {}
  21.  
  22.  
  23. local Animation = "Standing"
  24.  
  25.  
  26. local charWelds = {}
  27.  
  28. local Config = {
  29. standingSway = math.pi/45;
  30. walkingSway = math.pi/14;
  31. standingOffset = math.pi/80;
  32. walkingOffset = math.pi/48;
  33. }
  34.  
  35.  
  36.  
  37. Humanoid.WalkSpeed = 22.4
  38. Humanoid.JumpPower = 40
  39.  
  40. --Camera.CameraType = "Scriptable"
  41.  
  42.  
  43.  
  44.  
  45. charWelds.HumanoidRootPart = Instance.new("Weld", HumanoidRootPart)
  46. charWelds.HumanoidRootPart.Part0 = HumanoidRootPart
  47. charWelds.HumanoidRootPart.Part1 = Torso
  48.  
  49. charWelds.rightArmWeld = Instance.new("Weld", Torso)
  50. charWelds.rightArmWeld.Part0 = Torso
  51. charWelds.rightArmWeld.Part1 = RightArm
  52. charWelds.rightArmWeld.C0 = CFrame.new(1.5, .5, 0)
  53. charWelds.rightArmWeld.C1 = CFrame.new(0, .5, 0)
  54.  
  55. charWelds.leftArmWeld = Instance.new("Weld", Torso)
  56. charWelds.leftArmWeld.Part0 = Torso
  57. charWelds.leftArmWeld.Part1 = LeftArm
  58. charWelds.leftArmWeld.C0 = CFrame.new(-1.5, .5, 0)
  59. charWelds.leftArmWeld.C1 = CFrame.new(0, .5, 0)
  60.  
  61. charWelds.rightLegWeld = Instance.new("Weld", Torso)
  62. charWelds.rightLegWeld.Part0 = Torso
  63. charWelds.rightLegWeld.Part1 = RightLeg
  64. charWelds.rightLegWeld.C0 = CFrame.new(.5, -1.5, 0)
  65. charWelds.rightLegWeld.C1 = CFrame.new(0, .5, 0)
  66.  
  67. charWelds.leftLegWeld = Instance.new("Weld", Torso)
  68. charWelds.leftLegWeld.Part0 = Torso
  69. charWelds.leftLegWeld.Part1 = LeftLeg
  70. charWelds.leftLegWeld.C0 = CFrame.new(-.5, -1.5, 0)
  71. charWelds.leftLegWeld.C1 = CFrame.new(0, .5, 0)
  72.  
  73. local Equipment = Instance.new("Folder", Character)
  74.  
  75.  
  76.  
  77.  
  78. function Funcs.CFrameInterpolate(oc, c, v)
  79. local oc1, oc2, oc3, oc4, oc5, oc6, oc7, oc8, oc9, oc10, oc11, oc12 = oc:components()
  80. local c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12 = c:components()
  81. return CFrame.new(
  82. oc1 + (c1 - oc1) * v, oc2 + (c2 - oc2) * v, oc3 + (c3 - oc3) * v, oc4 + (c4 - oc4) * v, oc5 + (c5 - oc5) * v, oc6 + (c6 - oc6) * v
  83. , oc7 + (c7 - oc7) * v, oc8 + (c8 - oc8) * v, oc9 + (c9 - oc9) * v, oc10 + (c10 - oc10) * v, oc11 + (c11 - oc11) * v, oc12 + (c12 - oc12) * v
  84. )
  85. end
  86.  
  87. function Funcs.Trail(p, c1, c2)
  88. local mag = (c2.p - c1.p).magnitude
  89. p.Size = Vector3.new(0, 0, mag)
  90. p.CFrame = CFrame.new(c1.p:Lerp(c2.p, 0.5))
  91. p.CFrame = CFrame.new(p.CFrame.p, c2.p)
  92. end
  93.  
  94. function Funcs.AngleInterpolate(w,c,x,y,z,x1,y1,z1,l)
  95. w.C1 = c * CFrame.fromEulerAnglesXYZ(
  96. x + math.sin(math.pi / 2 * l) * (x1 - x)
  97. , y + math.sin(math.pi / 2 * l) * (y1 - y)
  98. , z + math.sin(math.pi / 2 * l) * (z1 - z)
  99. )
  100. end
  101.  
  102. function Funcs.Part(Parent, t)
  103. local Part = Instance.new("Part", Parent)
  104. Part.BrickColor = t[2]
  105. Part.FormFactor = 3
  106. Part.TopSurface, Part.BottomSurface, Part.LeftSurface, Part.RightSurface
  107. , Part.FrontSurface, Part.BackSurface = 10, 10, 10, 10, 10, 10
  108. Part.CanCollide = t[1]
  109. Part.Transparency = t[3]
  110. Part.Material = t[4]
  111. Part.Reflectance = t[5]
  112. Part.Shape = t[6]
  113. Part.Size = t[7]
  114. return Part
  115. end
  116.  
  117. function Funcs.BlockMesh(Part, Scale)
  118. local BlockMesh = Instance.new("BlockMesh", Part)
  119. BlockMesh.Scale = Scale
  120. return BlockMesh
  121. end
  122.  
  123. function Funcs.CylinderMesh(Part, Scale)
  124. local CylinderMesh = Instance.new("CylinderMesh", Part)
  125. CylinderMesh.Scale = Scale
  126. return CylinderMesh
  127. end
  128.  
  129. function Funcs.SpecialMesh(Part, Scale, MeshType)
  130. local SpecialMesh = Instance.new("SpecialMesh", Part)
  131. SpecialMesh.Scale = Scale
  132. SpecialMesh.MeshType = MeshType
  133. return SpecialMesh
  134. end
  135.  
  136. function Funcs.Weld(Part0, Part1, C0)
  137. local Weld = Instance.new("Weld", Part0)
  138. Weld.Part0, Weld.Part1, Weld.C0 = Part0, Part1, C0
  139. return Weld
  140. end
  141.  
  142. function Funcs.AddEquipment()
  143.  
  144. Whip = Funcs.Part(Equipment, {true, BrickColor.new("Brown"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0.2, 0.2, 1.6)})
  145. local WhipWeld = Funcs.Weld(RightArm, Whip, CFrame.new(0, -1.1, -0.6))
  146.  
  147. Rope = Funcs.Part(Equipment, {false, BrickColor.new("Really black"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 1)})
  148. local RopeMesh = Funcs.BlockMesh(Rope, Vector3.new(0.4, 0.4, 1))
  149. Rope.Anchored = true
  150.  
  151. RopeE = Funcs.Part(Equipment, {false, BrickColor.new("Dark stone grey"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 0)})
  152. local RopeEMesh = Funcs.SpecialMesh(RopeE, Vector3.new(0.8, 0.8, 0.8), "Sphere")
  153. RopeE.Anchored = true
  154.  
  155. end
  156.  
  157. local ropeEnd = CFrame.new(0, 0, 0)
  158.  
  159. function Funcs.Whip()
  160. if Animation ~= "Throwing" then
  161. Animation = "Throwing"
  162.  
  163. for i = 0, 1, 0.1 do
  164. Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0)
  165. , 0, 0, 0, 0, math.pi / 8, 0, i)
  166. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  167. , 0, 0, -math.pi / 8, -math.pi * 5 / 4, 0, math.pi / 12, i)
  168. wait()
  169. end
  170.  
  171. local targ = Mouse.Target
  172. local cf = Mouse.Hit
  173.  
  174. for i = 0, 1, 0.2 do
  175. Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0)
  176. , 0, math.pi / 8, 0, 0, 0, 0, i)
  177. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  178. , -math.pi * 5 / 4, 0, math.pi / 8, 0, 0, -math.pi / 12, i)
  179. wait()
  180. end
  181.  
  182. if (Torso.Position - cf.p).magnitude < 120 then
  183. ropeEnd = cf
  184.  
  185. wait(1 / 2)
  186. if targ and targ.Parent and targ.Parent:FindFirstChild("Humanoid") then
  187. targ.Parent:BreakJoints()
  188. end
  189.  
  190. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  191. end
  192.  
  193. Animation = "Standing"
  194. end
  195. end
  196.  
  197. local Snd = Instance.new("Sound", Torso)
  198. Snd.SoundId = "rbxassetid://163277488"
  199. Snd.Volume = 100
  200.  
  201. Mouse.Button1Down:connect(function()
  202. Snd:Play()
  203. Funcs.Whip()
  204. end)
  205.  
  206.  
  207. Funcs.AddEquipment()
  208.  
  209. local i = 0
  210. local camGoal = Head.CFrame
  211. local ropeCEnd = RightArm.CFrame
  212. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  213.  
  214.  
  215. RunService.Stepped:connect(function()
  216.  
  217.  
  218. local animSpeed = 0.02
  219. local offsetMultiplier = 1
  220.  
  221.  
  222. local ropeStart = Whip.CFrame * CFrame.new(0, 0, -0.7)
  223. ropeCEnd = CFrame.new(ropeCEnd.p:Lerp(ropeEnd.p, 0.2))
  224. RopeE.CFrame = ropeCEnd
  225. if Animation ~= "Throwing" then
  226. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  227. end
  228.  
  229. Funcs.Trail(Rope, ropeStart, ropeCEnd)
  230.  
  231.  
  232.  
  233. if Humanoid.Jump == true then
  234. if Animation ~= "Throwing" then
  235. Animation = "Jumping"
  236.  
  237. end
  238. animSpeed = 0.001
  239. offsetMultiplier = 3
  240. elseif Torso.Velocity.magnitude > 0.4 then
  241. if Animation ~= "Throwing" then
  242. Animation = "Walking"
  243. end
  244. animSpeed = 0.1
  245. offsetMultiplier = 1
  246. else
  247. if Animation ~= "Throwing" then
  248. Animation = "Standing"
  249. end
  250. animSpeed = 0.02
  251. offsetMultiplier = 1
  252. end
  253.  
  254.  
  255. if i < 2 then
  256. i = i + animSpeed
  257. else
  258. i = 0
  259. end
  260.  
  261.  
  262. if Animation == "Standing" or Animation == "Throwing" then
  263. if i < 1 then
  264. if Animation ~= "Throwing" then
  265. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  266. , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i)
  267. end
  268. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  269. , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i)
  270. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  271. , Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i)
  272. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  273. , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i)
  274. elseif i >= 1 then
  275. if Animation ~= "Throwing" then
  276. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  277. , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i - 1)
  278. end
  279. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  280. , Config.standingSway, 0, Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i - 1)
  281. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  282. , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i - 1)
  283. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  284. , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i - 1)
  285. end
  286. end
  287. if Animation == "Walking" or Animation == "Jumping" or Animation == "Throwing" or Animation == "Shooting" then
  288. if i < 1 then
  289. if Animation ~= "Throwing" then
  290. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  291. , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i)
  292. end
  293. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  294. , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i)
  295. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  296. , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i)
  297. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  298. , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i)
  299. elseif i >= 1 then
  300. if Animation ~= "Throwing" then
  301. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  302. , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i - 1)
  303. end
  304. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  305. , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i - 1)
  306. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  307. , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i - 1)
  308. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  309. , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i - 1)
  310. end
  311. end
  312.  
  313. end)
Add Comment
Please, Sign In to add comment