Advertisement
DaOMEGAa32

classic

Nov 15th, 2019
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.06 KB | None | 0 0
  1. wait (1)
  2. local Player = game.Players.localPlayer
  3. local Character = Player.Character
  4. local Humanoid = Character.Humanoid
  5. local Mouse = Player:GetMouse()
  6. local LeftArm = Character["Left Arm"]
  7. local RightArm = Character["Right Arm"]
  8. local LeftLeg = Character["Left Leg"]
  9. local RightLeg = Character["Right Leg"]
  10. local Head = Character.Head
  11. local Torso = Character.Torso
  12. local Camera = game.Workspace.CurrentCamera
  13. local RootPart = Character.HumanoidRootPart
  14. local RootJoint = RootPart.RootJoint
  15. local attack = false
  16. local Anim = 'Idle'
  17. local attacktype = 1
  18. local delays = false
  19. local play = true
  20. local targetted = nil
  21. local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
  22. local velocity = RootPart.Velocity.y
  23. local sine = 0
  24. local change = 1
  25. local doe = 0
  26. local Create = LoadLibrary("RbxUtility").Create
  27. P=Instance.new("ForceField", game.Players.LocalPlayer.Character)
  28. P.Visible = false
  29. local Lighty = game:GetService"Lighting"
  30. local Sitting = false
  31. local idleC = 0
  32. local m = Create("Model"){
  33. Parent = Character,
  34. Name = "WeaponModel",
  35. }
  36. spawn(function()
  37. Character.Humanoid.MaxHealth = math.huge
  38. Character.Humanoid.Health = math.huge
  39. while wait() do
  40. Head.BrickColor = BrickColor.new("Bright yellow")
  41. RightArm.BrickColor = BrickColor.new("Bright yellow")
  42. LeftArm.BrickColor = BrickColor.new("Bright yellow")
  43. Torso.BrickColor = BrickColor.new("Bright blue")
  44. RightLeg.BrickColor = BrickColor.new("Shamrock")
  45. LeftLeg.BrickColor = BrickColor.new("Shamrock")
  46. end
  47. end)
  48. for i,v in pairs(Character:children()) do
  49. if v:IsA("Accessory") then
  50. v:Destroy()
  51. end
  52. end
  53. for i,v in pairs(Character:children()) do
  54. if v:IsA("Shirt") then
  55. v:Destroy()
  56. end
  57. end
  58. for i,v in pairs(Character:children()) do
  59. if v:IsA("Pants") then
  60. v:Destroy()
  61. end
  62. end
  63. for i,v in pairs(Character:children()) do
  64. if v:IsA("Graphic Shirt") then
  65. v:Destroy()
  66. end
  67. end
  68. function waitForChild(parent, childName)
  69. local child = parent:findFirstChild(childName)
  70. if child then return child end
  71. while true do
  72. child = parent.ChildAdded:wait()
  73. if child.Name==childName then return child end
  74. end
  75. end
  76.  
  77.  
  78. -- ANIMATION
  79.  
  80. -- declarations
  81.  
  82. local Figure = script.Parent
  83. local Torso = waitForChild(Figure, "Torso")
  84. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  85. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  86. local RightHip = waitForChild(Torso, "Right Hip")
  87. local LeftHip = waitForChild(Torso, "Left Hip")
  88. local Neck = waitForChild(Torso, "Neck")
  89. local Humanoid = waitForChild(Figure, "Humanoid")
  90. local pose = "Standing"
  91.  
  92. local toolAnim = "None"
  93. local toolAnimTime = 0
  94.  
  95. local jumpMaxLimbVelocity = 0.75
  96.  
  97. -- functions
  98.  
  99. function onRunning(speed)
  100. if speed>0 then
  101. pose = "Running"
  102. else
  103. pose = "Standing"
  104. end
  105. end
  106.  
  107. function onDied()
  108. pose = "Dead"
  109. end
  110.  
  111. function onJumping()
  112. pose = "Jumping"
  113. end
  114.  
  115. function onClimbing()
  116. pose = "Climbing"
  117. end
  118.  
  119. function onGettingUp()
  120. pose = "GettingUp"
  121. end
  122.  
  123. function onFreeFall()
  124. pose = "FreeFall"
  125. end
  126.  
  127. function onFallingDown()
  128. pose = "FallingDown"
  129. end
  130.  
  131. function onSeated()
  132. pose = "Seated"
  133. end
  134.  
  135. function onPlatformStanding()
  136. pose = "PlatformStanding"
  137. end
  138.  
  139. function onSwimming(speed)
  140. if speed>0 then
  141. pose = "Running"
  142. else
  143. pose = "Standing"
  144. end
  145. end
  146.  
  147. function moveJump()
  148. RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  149. LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  150. RightShoulder:SetDesiredAngle(3.14)
  151. LeftShoulder:SetDesiredAngle(-3.14)
  152. RightHip:SetDesiredAngle(0)
  153. LeftHip:SetDesiredAngle(0)
  154. end
  155.  
  156.  
  157. -- same as jump for now
  158.  
  159. function moveFreeFall()
  160. RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  161. LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  162. RightShoulder:SetDesiredAngle(3.14)
  163. LeftShoulder:SetDesiredAngle(-3.14)
  164. RightHip:SetDesiredAngle(0)
  165. LeftHip:SetDesiredAngle(0)
  166. end
  167.  
  168. function moveSit()
  169. RightShoulder.MaxVelocity = 0.15
  170. LeftShoulder.MaxVelocity = 0.15
  171. RightShoulder:SetDesiredAngle(3.14 /2)
  172. LeftShoulder:SetDesiredAngle(-3.14 /2)
  173. RightHip:SetDesiredAngle(3.14 /2)
  174. LeftHip:SetDesiredAngle(-3.14 /2)
  175. end
  176.  
  177. function getTool()
  178. for _, kid in ipairs(Figure:GetChildren()) do
  179. if kid.className == "Tool" then return kid end
  180. end
  181. return nil
  182. end
  183.  
  184. function getToolAnim(tool)
  185. for _, c in ipairs(tool:GetChildren()) do
  186. if c.Name == "toolanim" and c.className == "StringValue" then
  187. return c
  188. end
  189. end
  190. return nil
  191. end
  192.  
  193. function animateTool()
  194.  
  195. if (toolAnim == "None") then
  196. RightShoulder:SetDesiredAngle(1.57)
  197. return
  198. end
  199.  
  200. if (toolAnim == "Slash") then
  201. RightShoulder.MaxVelocity = 0.5
  202. RightShoulder:SetDesiredAngle(0)
  203. return
  204. end
  205.  
  206. if (toolAnim == "Lunge") then
  207. RightShoulder.MaxVelocity = 0.5
  208. LeftShoulder.MaxVelocity = 0.5
  209. RightHip.MaxVelocity = 0.5
  210. LeftHip.MaxVelocity = 0.5
  211. RightShoulder:SetDesiredAngle(1.57)
  212. LeftShoulder:SetDesiredAngle(1.0)
  213. RightHip:SetDesiredAngle(1.57)
  214. LeftHip:SetDesiredAngle(1.0)
  215. return
  216. end
  217. end
  218.  
  219. function move(time)
  220. local amplitude
  221. local frequency
  222.  
  223. if (pose == "Jumping") then
  224. moveJump()
  225. return
  226. end
  227.  
  228. if (pose == "FreeFall") then
  229. moveFreeFall()
  230. return
  231. end
  232.  
  233. if (pose == "Seated") then
  234. moveSit()
  235. return
  236. end
  237.  
  238. local climbFudge = 0
  239.  
  240. if (pose == "Running") then
  241. if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
  242. RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  243. else
  244. RightShoulder.MaxVelocity = 0.15
  245. end
  246. if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
  247. LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  248. else
  249. LeftShoulder.MaxVelocity = 0.15
  250. end
  251. amplitude = 1
  252. frequency = 9
  253. elseif (pose == "Climbing") then
  254. RightShoulder.MaxVelocity = 0.5
  255. LeftShoulder.MaxVelocity = 0.5
  256. amplitude = 1
  257. frequency = 9
  258. climbFudge = 3.14
  259. else
  260. amplitude = 0.1
  261. frequency = 1
  262. end
  263.  
  264. desiredAngle = amplitude * math.sin(time*frequency)
  265.  
  266. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  267. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  268. RightHip:SetDesiredAngle(-desiredAngle)
  269. LeftHip:SetDesiredAngle(-desiredAngle)
  270.  
  271.  
  272. local tool = getTool()
  273.  
  274. if tool then
  275.  
  276. animStringValueObject = getToolAnim(tool)
  277.  
  278. if animStringValueObject then
  279. toolAnim = animStringValueObject.Value
  280. -- message recieved, delete StringValue
  281. animStringValueObject.Parent = nil
  282. toolAnimTime = time + .3
  283. end
  284.  
  285. if time > toolAnimTime then
  286. toolAnimTime = 0
  287. toolAnim = "None"
  288. end
  289.  
  290. animateTool()
  291.  
  292.  
  293. else
  294. toolAnim = "None"
  295. toolAnimTime = 0
  296. end
  297. end
  298.  
  299.  
  300. -- connect events
  301.  
  302. Humanoid.Died:connect(onDied)
  303. Humanoid.Running:connect(onRunning)
  304. Humanoid.Jumping:connect(onJumping)
  305. Humanoid.Climbing:connect(onClimbing)
  306. Humanoid.GettingUp:connect(onGettingUp)
  307. Humanoid.FreeFalling:connect(onFreeFall)
  308. Humanoid.FallingDown:connect(onFallingDown)
  309. Humanoid.Seated:connect(onSeated)
  310. Humanoid.PlatformStanding:connect(onPlatformStanding)
  311. Humanoid.Swimming:connect(onSwimming)
  312. -- main program
  313. print("Finding player... (This may take a little!)")
  314. wait (1)
  315. print("Found player. Now giving the sword.")
  316. local user = game.Players.LocalPlayer.Backpack
  317. local sword = Instance.new("Tool",user)
  318. print("Gave the player the sword. Enjoy!")
  319. local handle = Instance.new("Part",sword)
  320. local mesh = Instance.new("SpecialMesh",handle)
  321. local DAMAGE = 35
  322. local sound = Instance.new("Sound",handle)
  323. local sound2 = Instance.new("Sound",handle)
  324. sword.Name = "Sword"
  325. script.Parent = sword
  326. script.Name = "SwordScript"
  327. --local animation = Instance.new("Animation",script)
  328.  
  329. --animation.AnimationId = "http://www.roblox.com/Asset?ID=992817684"
  330.  
  331. sound.SoundId = "rbxasset://sounds//swordlunge.wav"
  332. sound.Volume = 3
  333. sound.PlaybackSpeed = 1.17
  334. sound.Name = "Slash"
  335. sound2.SoundId = "rbxasset://sounds//unsheath.wav"
  336. sound2.Volume = 3
  337. sound2.PlaybackSpeed = 0.8
  338. sound2.Volume = 3
  339. sound2.Name = "Unsheath"
  340.  
  341. function unsheathanimation()
  342. sword.GripPos = sword.GripPos + Vector3.new(0,5,0)
  343. for i = 1,5 do
  344. sword.GripPos = sword.GripPos + Vector3.new(0,-1,0)
  345. wait (0.1)
  346. end
  347. end
  348.  
  349. function unsheathsound()
  350. sound2:Play()
  351. end
  352.  
  353. function damage(hit)
  354.  
  355. local h = hit.Parent:FindFirstChild("Humanoid")
  356. if (h ~= nil) then
  357. h:TakeDamage(DAMAGE / 4)
  358. end
  359. end
  360.  
  361. function animate()
  362. --4
  363. sound:Play()
  364. for i = 1,5 do
  365. sword.GripUp = sword.GripUp + Vector3.new(0,0,1)
  366. wait (0)
  367. end
  368. sword.GripUp = sword.GripUp + Vector3.new(0,0,-1)
  369. end
  370. handle.Size = handle.Size + Vector3.new(-4,-1,-2)
  371. handle.Size = handle.Size + Vector3.new(0.6, 3.6, 0.4)
  372. handle.Name = "Handle"
  373.  
  374. mesh.MeshType = "FileMesh"
  375. mesh.MeshId = "http://www.roblox.com/asset/?id=94746028"
  376. mesh.TextureId = "http://www.roblox.com/asset/?ID=94746105"
  377. mesh.Offset = mesh.Offset + Vector3.new(0,1,0)
  378.  
  379. sword.Equipped:connect(unsheathanimation)
  380. sword.Equipped:connect(unsheathsound)
  381. wait(sound2.TimeLength)
  382. sword.Activated:connect(animate)
  383. handle.Touched:connect(damage)
  384. local runService = game:service("RunService");
  385.  
  386. while Figure.Parent~=nil do
  387. local _, time = wait(0.1)
  388. move(time)
  389. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement