Advertisement
Starmangamer05

rock thrower

Aug 17th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.10 KB | None | 0 0
  1. --script.Parent = game.Lighting
  2. wait()
  3. name = "Rock Thrower"
  4. scale = 1
  5. animate = true
  6. follow = false
  7. attacking = false
  8. attacking2 = false
  9. touched1 = nil
  10. touched2 = nil
  11. meh = nil
  12. player = nil
  13. pose = "Standing"
  14. toolAnim = "None"
  15. toolAnimTime = 0
  16. climbExtra = 0
  17. Colors={BrickColor.new("New Yeller"),BrickColor.new("Really red")}
  18. attacking2 = true
  19. coroutine.resume(coroutine.create(function()
  20. while attacking2 == true do
  21. wait()
  22. meh = findNearestTorso(Character.Torso.Position)
  23. end
  24. end))
  25. w = Instance.new("Weld")
  26.  
  27. function move(time)
  28. if animate == false then return end
  29. local amplitude
  30. local frequency
  31. if pose == "Jumping" then
  32. RightShoulder.MaxVelocity = 0.5
  33. LeftShoulder.MaxVelocity = 0.5
  34. RightShoulder.DesiredAngle = 3.14
  35. LeftShoulder.DesiredAngle = -3.14
  36. RightHip.DesiredAngle = 0
  37. LeftHip.DesiredAngle = 0
  38. return
  39. end
  40. if pose == "FreeFall" then
  41. RightShoulder.MaxVelocity = 0.5
  42. LeftShoulder.MaxVelocity = 0.5
  43. RightShoulder.DesiredAngle = 3.14
  44. LeftShoulder.DesiredAngle = -3.14
  45. RightHip.DesiredAngle = 0
  46. LeftHip.DesiredAngle = 0
  47. return
  48. end
  49. if pose == "Seated" then
  50. RightShoulder.MaxVelocity = 0.15
  51. LeftShoulder.MaxVelocity = 0.15
  52. RightShoulder.DesiredAngle = 3.14 / 2
  53. LeftShoulder.DesiredAngle = -3.14 / 2
  54. RightHip.DesiredAngle = 3.14 / 2
  55. LeftHip.DesiredAngle = -3.14 / 2
  56. return
  57. end
  58. if pose == "Running" then
  59. RightShoulder.MaxVelocity = 0.15
  60. LeftShoulder.MaxVelocity = 0.15
  61. amplitude = 1
  62. frequency = 9
  63. elseif pose == "climbExtra" then
  64. RightShoulder.MaxVelocity = 0.5
  65. LeftShoulder.MaxVelocity = 0.5
  66. amplitude = 1
  67. frequency = 9
  68. climbExtra = 3.14
  69. else
  70. amplitude = 0.1
  71. frequency = 1
  72. end
  73. desiredAngle = amplitude * math.sin(time * frequency)
  74. RightShoulder.DesiredAngle = desiredAngle + climbExtra
  75. LeftShoulder.DesiredAngle = desiredAngle - climbExtra
  76. RightHip.DesiredAngle = -desiredAngle
  77. LeftHip.DesiredAngle = -desiredAngle
  78. for _, Children in ipairs(Character:GetChildren()) do
  79. if Children.className == "Tool" then
  80. local tool = Children
  81. end
  82. end
  83. if tool then
  84. for _, Children in ipairs(Character:GetChildren()) do
  85. if Children.Name == "toolanim" and Children.className == "StringValue" then
  86. local animStringValueObject = Children
  87. end
  88. end
  89. if animStringValueObject then
  90. toolAnim = animStringValueObject.Value
  91. animStringValueObject.Parent = nil
  92. elseif time > toolAnimTime then
  93. toolAnimTime = 0
  94. end
  95. if toolAnim == "None" then
  96. RightShoulder.DesiredAngle = 1.57
  97. elseif toolAnim == "Slash" then
  98. RightShoulder.MaxVelocity = 0.5
  99. RightShoulder.DesiredAngle = 0
  100. elseif toolAnim == "Lunge" then
  101. RightShoulder.MaxVelocity = 0.5
  102. LeftShoulder.MaxVelocity = 0.5
  103. RightHip.MaxVelocity = 0.5
  104. LeftHip.MaxVelocity = 0.5
  105. RightShoulder.DesiredAngle = 1.57
  106. LeftShoulder.DesiredAngle = 1.0
  107. RightHip.DesiredAngle = 1.57
  108. LeftHip.DesiredAngle = 1.0
  109. end
  110. else
  111. toolAnim = "None"
  112. toolAnimTime = 0
  113. end
  114. end
  115.  
  116.  
  117. Template = Instance.new("Part")
  118. Template.formFactor = "Symmetric"
  119. Template.Size = Vector3.new(scale, scale, scale)
  120. Template.BrickColor = BrickColor.new("New Yeller")
  121. Template.Locked = true
  122. leftarmcolor = Template.BrickColor
  123. rightarmcolor = Template.BrickColor
  124. leftlegcolor = Template.BrickColor
  125. rightarmcolor = Template.BrickColor
  126. torsocolor = Template.BrickColor
  127. pos = Vector3.new(0, 10, 0)
  128. leftarmcolor = BrickColor.new("Sand green")
  129. rightarmcolor = BrickColor.new("Sand green")
  130. leftlegcolor = BrickColor.new("Sand green")
  131. rightlegcolor = BrickColor.new("Sand green")
  132. torsocolor = BrickColor.new("Dark stone grey")
  133. headcolor = BrickColor.new("Dark stone grey")
  134. LeftArm = Template:Clone()
  135. LeftArm.formFactor = "Symmetric"
  136. LeftArm.Size = Vector3.new(scale, scale * 2, scale)
  137. LeftArm.Name = "Left Arm"
  138. LeftArm.BrickColor = leftarmcolor
  139. RightArm = Template:Clone()
  140. RightArm.Size = Vector3.new(scale, scale * 2, scale)
  141. RightArm.Name = "Right Arm"
  142. RightArm.BrickColor = rightarmcolor
  143. local rock = Instance.new("Part")
  144. rock.Size = Vector3.new(3,3,3)
  145. rock.BrickColor = rightarmcolor
  146. LeftLeg = Template:Clone()
  147. LeftLeg.Size = Vector3.new(scale, scale * 2, scale)
  148. LeftLeg.Name = "Left Leg"
  149. LeftLeg.BrickColor = leftlegcolor
  150. RightLeg = Template:Clone()
  151. RightLeg.Size = Vector3.new(scale, scale * 2, scale)
  152. RightLeg.Name = "Right Leg"
  153. RightLeg.BrickColor = rightlegcolor
  154. Torso = Template:Clone()
  155. Torso.Size = Vector3.new(scale * 2, scale * 2, scale)
  156. Torso.LeftSurface = "Weld"
  157. Torso.RightSurface = "Weld"
  158. Torso.Position = pos + Vector3.new(0, scale * 3.5, 0)
  159. Torso.Name = "Torso"
  160. Torso.BrickColor = torsocolor
  161. Head = Template:Clone()
  162. Head.Size = Vector3.new(scale * 2, scale, scale)
  163. Head.TopSurface = "Smooth"
  164. Head.BottomSurface = "Smooth"
  165. Head.Name = "Head"
  166. Head.BrickColor = headcolor
  167. Mesh = Instance.new("SpecialMesh")
  168. Mesh.MeshType = "Head"
  169. Mesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  170. Mesh.Parent = Head
  171. Face = Instance.new("Decal")
  172. Face.Parent = Head
  173. Face.Name = "face"
  174. if math.random(1,2) == 1 then
  175. Face.Texture = "http://www.roblox.com/asset/?id=25547935"
  176. else
  177. Face.Texture = "http://www.roblox.com/asset/?id=32333940"
  178. end
  179. Character = Instance.new("Model")
  180. Character.Name = name
  181.  
  182. --script.Parent = Character
  183. Humanoid = Instance.new("Humanoid")
  184. Humanoid.WalkSpeed = 13
  185. LeftArm.Parent = Character
  186. RightArm.Parent = Character
  187. rock.Parent = Character
  188. LeftLeg.Parent = Character
  189. RightLeg.Parent = Character
  190. Torso.Parent = Character
  191. Head.Parent = Character
  192. Humanoid.Parent = Character
  193. local weld = Instance.new("Weld")
  194. weld.Parent = rock
  195. weld.Part0 = rock
  196. weld.Part1 = RightArm
  197. weld.C0 = CFrame.new(0,1,0)
  198. LeftShoulder = Instance.new("Motor")
  199. LeftShoulder.Parent = Torso
  200. LeftShoulder.Part0 = Torso
  201. LeftShoulder.Part1 = LeftArm
  202. LeftShoulder.MaxVelocity = 0.1
  203. LeftShoulder.C0 = CFrame.new(-Torso.Size.x / 2 - LeftArm.Size.x / 2, LeftArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  204. LeftShoulder.C1 = CFrame.new(0, LeftArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  205. LeftShoulder.Name = "Left Shoulder"
  206. RightShoulder = Instance.new("Motor")
  207. RightShoulder.Parent = Torso
  208. RightShoulder.Part0 = Torso
  209. RightShoulder.Part1 = RightArm
  210. RightShoulder.MaxVelocity = 0.1
  211. RightShoulder.C0 = CFrame.new(Torso.Size.x / 2 + RightArm.Size.x / 2, RightArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  212. RightShoulder.C1 = CFrame.new(0, RightArm.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  213. RightShoulder.Name = "Right Shoulder"
  214. LeftHip = Instance.new("Motor")
  215. LeftHip.Parent = Torso
  216. LeftHip.Part0 = Torso
  217. LeftHip.Part1 = LeftLeg
  218. LeftHip.MaxVelocity = 0.1
  219. LeftHip.C0 = CFrame.new(-LeftLeg.Size.x / 2, -(LeftLeg.Size.y / 4) * 3, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  220. LeftHip.C1 = CFrame.new(0, LeftLeg.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, -3.14 / 2, 0)
  221. LeftHip.Name = "Left Hip"
  222. RightHip = Instance.new("Motor")
  223. RightHip.Parent = Torso
  224. RightHip.Part0 = Torso
  225. RightHip.Part1 = RightLeg
  226. RightHip.MaxVelocity = 0.1
  227. RightHip.C0 = CFrame.new(RightLeg.Size.x / 2, -(RightLeg.Size.y / 4) * 3, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  228. RightHip.C1 = CFrame.new(0, RightLeg.Size.y / 4, 0) * CFrame.fromEulerAnglesXYZ(0, 3.14 / 2, 0)
  229. RightHip.Name = "Right Hip"
  230. Neck = Instance.new("Weld")
  231. Neck.Name = "Neck"
  232. Neck.Part0 = Torso
  233. Neck.Part1 = Head
  234. Neck.C0 = CFrame.new(0, 1.5 * scale, 0)
  235. Neck.C1 = CFrame.new()
  236. Neck.Parent = Torso
  237. --[[Children = owner.Character:GetChildren()
  238. for i = 1, #Children do
  239. if Children[i].className == "Shirt" or Children[i].className == "Pants" and scale == 1 then
  240. Children[i]:Clone().Parent = Character
  241. end
  242. if Children[i].className == "Hat" then
  243. if Children[i]:FindFirstChild("Handle") ~= nil then
  244. Hat = Instance.new("Hat")
  245. Children[i].Handle:Clone().Parent = Hat
  246. Hat.Handle.Size = Hat.Handle.Size * scale
  247. Hat.Handle.Mesh.Scale = Hat.Handle.Mesh.scale * scale
  248. if scale == 1 then TempScale = 1 else TempScale = scale * 1.5 end
  249. Hat.AttachmentPos = Children[i].AttachmentPos * TempScale
  250. Hat.AttachmentUp = Children[i].AttachmentUp
  251. Hat.AttachmentForward = Children[i].AttachmentForward
  252. Hat.AttachmentRight = Children[i].AttachmentRight
  253. Hat.Parent = Character
  254. end
  255. end
  256. end]]
  257. Character.Parent = game:GetService("Workspace")
  258. Humanoid.Died:connect(function() pose = "Dead" wait(5.5) if Character == nil then script:Remove() return end Character:Remove() script:Remove() end)
  259. Humanoid.Running:connect(function(speed) if speed > 0 then pose = "Running" else pose = "Standing" end end)
  260. Humanoid.Jumping:connect(function() pose = "Jumping" end)
  261. Humanoid.Climbing:connect(function() pose = "climbExtra" end)
  262. Humanoid.GettingUp:connect(function() pose = "GettingUp" end)
  263. Humanoid.FreeFalling:connect(function() pose = "FreeFall" end)
  264. Humanoid.FallingDown:connect(function() pose = "FallingDown" end)
  265. Humanoid.Seated:connect(function() pose = "Seated" end)
  266. Humanoid.PlatformStanding:connect(function() pose = "PlatformStanding" end)
  267.  
  268. function kill(hit)
  269. if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Name ~= "Base" and hit.Parent.Name ~= "Rock Thrower" then
  270. hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 1
  271. end
  272. end
  273.  
  274. Torso.Touched:connect(function(hit) kill(hit) end)
  275.  
  276. coroutine.resume(coroutine.create(function()
  277. local larm = Character:FindFirstChild("Left Arm")
  278. local rarm = Character:FindFirstChild("Right Arm")
  279.  
  280. function findNearestTorso(pos)
  281. local list = game.Workspace:children()
  282. local torso = nil
  283. local dist = 1000
  284. local temp = nil
  285. local human = nil
  286. local temp2 = nil
  287. for x = 1, #list do
  288. temp2 = list[x]
  289. if (temp2.className == "Model") and (temp2 ~= Character) and (temp2.Name ~= "Rock Thrower") then
  290. temp = temp2:findFirstChild("Torso")
  291. human = temp2:findFirstChild("Humanoid")
  292. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  293. if (temp.Position - pos).magnitude < dist then
  294. torso = temp
  295. dist = (temp.Position - pos).magnitude
  296. end
  297. end
  298. end
  299. end
  300. return torso
  301. end
  302.  
  303. while true do
  304. wait(0.1)
  305. local target = meh
  306. if target ~= nil then
  307. Character.Humanoid:MoveTo(target.Position, target)
  308. end
  309. end
  310. end))
  311. coroutine.resume(coroutine.create(function()
  312. while true do
  313. wait(1)
  314. local target = findNearestTorso(Character.Torso.Position)
  315. if target ~= nil then
  316. if attacking2 == true then
  317. local RSH = Torso["Right Shoulder"]
  318. RSH.Parent = nil
  319. local RW = Instance.new("Weld")
  320. RW.Parent = RightArm
  321. RW.Part0 = Torso
  322. RW.Part1 = RightArm
  323. RW.C0 = CFrame.new(1.5, 0.5, 0)
  324. RW.C1 = CFrame.new(0, 0.5, 0)
  325. -- if math.random(1,2) == 1 then
  326. wait(4)
  327. for i = 0,1,0.1 do
  328. wait()
  329. RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(200)*i,0,0)
  330. end
  331. wait(0.3)
  332. for i = 0,1,0.2 do
  333. wait()
  334. RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-math.rad(120)*i+math.rad(200),0,0)
  335. end
  336. Character.Humanoid.WalkSpeed = 16
  337. rock:BreakJoints()
  338. rock.Velocity = Torso.CFrame.lookVector * 300
  339. rockhit = 0
  340. rock.Touched:connect(function(hit) kill(b,hit) end)
  341.  
  342. function kill(brick,hit)
  343. if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Name ~= "Base" and hit.Parent.Name ~= "Rock Thrower" then
  344. if rockhit == 0 then
  345. rockhit = 1
  346. local p = Instance.new("Part")
  347. p.Parent = game.workspace
  348. p.CFrame = rock.CFrame
  349. p.Name = "tinyrock"
  350. p.Size = Vector3.new(1,1,1)
  351. p.BrickColor = rightarmcolor
  352. p:BreakJoints()
  353. local p2 = p:Clone()
  354. p2.Parent = workspace
  355. p2.Name = "tinyrock"
  356. p2:BreakJoints()
  357. p3 = p2:Clone()
  358. p3.Parent = workspace
  359. p3.Name = "tinyrock"
  360. p3:BreakJoints()
  361. p4 = p2:Clone()
  362. p4.Parent = workspace
  363. p4.Name = "tinyrock"
  364. p4:BreakJoints()
  365. rock.Parent = nil
  366. hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 30
  367. hit.Parent.Humanoid.PlatformStand = true
  368. wait(0.5)
  369. hit.Parent.Humanoid.PlatformStand = false
  370. wait(4)
  371. p:Remove()
  372. p2:Remove()
  373. p3:Remove()
  374. p4:Remove()
  375. end
  376. end
  377. end
  378. wait(1)
  379. RW.Parent = nil
  380. RSH.Parent = Torso
  381. wait(3)
  382. Humanoid.WalkSpeed = 13
  383. rock.Parent = Character
  384. local weld = Instance.new("Weld")
  385. weld.Parent = rock
  386. weld.Part0 = rock
  387. weld.Part1 = RightArm
  388. weld.C0 = CFrame.new(0,1,0)
  389. --[[ else
  390. local LSH = Torso["Left Shoulder"]
  391. LSH.Parent = nil
  392. local LW = Instance.new("Weld")
  393. LW.Parent = RightArm
  394. LW.Part0 = Torso
  395. LW.Part1 = RightArm
  396. LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(120),0,0)
  397. LW.C1 = CFrame.new(0, 0.5, 0)
  398. RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(120),0,0)
  399. end]]
  400. end
  401. end
  402. end
  403. end))
  404. while Character.Parent ~= nil do
  405. wait(0.1)
  406. move(game:GetService("Workspace").DistributedGameTime)
  407. if Character.Parent ~= nil then
  408. if Character.Humanoid.Sit == true then
  409. wait(math.random(0,3))
  410. Character.Humanoid.Jump = true
  411. Character.Humanoid.Sit = false
  412. end
  413. end
  414. if Character.Parent ~= nil then
  415. if Character.Humanoid.PlatformStand == true then
  416. wait(math.random(0,3))
  417. Character.Humanoid.PlatformStand = false
  418. end
  419. end
  420. end
  421. -- lego blockland This acts as a chat filter. Don't ask why I do it. I just do >.>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement