Advertisement
Orangeplayer1431

minecraft bow ^_^ xd

Jun 13th, 2017
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.76 KB | None | 0 0
  1. --mediafire--[[MCBow by DroptheBomb]]
  2. script.Parent = nil
  3. local player = "Big_smoke643" -- Insert name here
  4.  
  5. local p = nil
  6. for _,v in pairs(game.Players:GetChildren()) do
  7. if (string.lower(player)==string.lower(v.Name)) then
  8. p = v
  9. end
  10. end
  11. if (p==nil) then return print("Cannot find player "..player) end
  12.  
  13. local equipped = false
  14. local noarrow = false
  15. local delayTime = .05 --editable. Description: The interval of time that passes before a player is enabled to shoot another arrow after shooting one
  16. local damage = 100 --editable. Description: The amount of damage dealt to any found humanoid.
  17. local bowScale = 1 --editable. Description: The WHOLE NUMBER size of the bow. acceptable range is from 1 to Infinity.
  18. local velocityMin,velocityMax = 400,600 --editable. Description: The maximum and minimum allowed velocity for arrows.
  19.  
  20. bu = (bowScale+1)/10
  21. hbu = bu/2
  22. dbu = bu*2
  23. cubevec = Vector3.new(bu, bu, bu)
  24. reczvec = Vector3.new(bu*2, bu, bu)
  25. recxvec = Vector3.new(bu, bu, bu*2)
  26.  
  27. function creczvec(num)
  28. return Vector3.new(bu*num, bu, bu)
  29. end
  30.  
  31. function crecxvec(num)
  32. return Vector3.new(bu, bu, bu*num)
  33. end
  34.  
  35. han = nil
  36. m = nil
  37. rg = nil
  38. bowp = {
  39. add = function(self, ...)
  40. local arg = {...}
  41. for i = 1,#arg do
  42. table.insert(self.dat, arg[i])
  43. end
  44. end;
  45. dat = {}
  46. }
  47. local mid = {"http://www.roblox.com/asset/?id=85561125","http://www.roblox.com/asset/?id=85561640","http://www.roblox.com/asset/?id=85561157","http://www.roblox.com/asset/?id=85643448","http://www.roblox.com/asset/?id=49092825","http://www.roblox.com/asset/?id=36527138"}
  48. local sid = {"http://www.roblox.com/asset/?id=16211041","http://www.roblox.com/asset/?id=16211030"}
  49. for i = 1,#mid do
  50. game:GetService("ContentProvider"):Preload(mid[i])
  51. end
  52. for i = 1,#sid do
  53. game:GetService("ContentProvider"):Preload(sid[i])
  54. end
  55.  
  56. function cp(pa, mo)
  57. local c = pa:clone()
  58. c.Parent = mo
  59. return c
  60. end
  61.  
  62. function xbu(num)
  63. if (type(num)==type(1)) then
  64. return bu*num
  65. end
  66. end
  67.  
  68. if (math.floor(bowScale)<bowScale) and (bowScale<math.floor(bowScale)+1) then
  69. return print("Error: Can not add decimal to whole number scale (NON-WHOLE)")
  70. elseif (math.floor(bowScale)<1) then
  71. return print("Error: Can not have bowScale property below 1 (NON-WHOLE)")
  72. end
  73.  
  74. if (bowScale>5) then
  75. print("You're going to have a pretty big bow")
  76. end
  77.  
  78. function createbow()
  79. if (p.Character==nil) then return end
  80. local char = p.Character
  81. if (char:FindFirstChild("Head")==nil) then return end
  82. local he = char["Head"]
  83. if (char:FindFirstChild("Right Arm")==nil) then return end
  84. local ra = char["Right Arm"]
  85. m = Instance.new("Model")
  86. m.Name = player.."'s bow"
  87. han = Instance.new("Part", m)
  88. Instance.new("BlockMesh", han)
  89. han.BrickColor = BrickColor.New("Silver flip/flop")
  90. han.Name = "Grip"
  91. han.FormFactor = 3
  92. han.Size = cubevec
  93. han.TopSurface = 0
  94. han.BottomSurface = 0
  95. local ha1 = cp(han, m)
  96. ha1.Name = "bowpart"
  97. ha1.CFrame = han.CFrame*CFrame.new(bu, 0, -bu)
  98. local ha2 = cp(ha1, m)
  99. ha2.CFrame = han.CFrame*CFrame.new(-bu, 0, bu)
  100. local ha3 = cp(ha1, m)
  101. ha3.CFrame = han.CFrame*CFrame.new(dbu, 0, 0)
  102. local ha4 = cp(ha1, m)
  103. ha4.CFrame = han.CFrame*CFrame.new(bu, 0, bu)
  104. local ha5 = cp(ha1, m)
  105. ha5.CFrame = han.CFrame*CFrame.new(0, 0, dbu)
  106. local ha6 = cp(ha1, m)
  107. ha6.BrickColor = BrickColor.new("Medium stone grey")
  108. ha6.CFrame = han.CFrame*CFrame.new(bu, 0, 0)
  109. local ha7 = cp(ha6, m)
  110. ha7.CFrame = han.CFrame*CFrame.new(0, 0, bu)
  111. local ha8 = cp(ha1, m)
  112. ha8.BrickColor = BrickColor.new("Brown")
  113. ha8.CFrame = han.CFrame*CFrame.new(dbu, 0, bu)
  114. local ha9 = cp(ha8, m)
  115. ha9.CFrame = han.CFrame*CFrame.new(bu, 0, dbu)
  116. local h10 = cp(ha8, m)
  117. h10.Size = recxvec
  118. h10.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -hbu)
  119. local h11 = cp(ha8, m)
  120. h11.Size = reczvec
  121. h11.CFrame = han.CFrame*CFrame.new(-hbu, 0, xbu(3))
  122. local h12 = cp(ha1, m)
  123. h12.BrickColor = BrickColor.new("Yellow flip/flop")
  124. h12.CFrame = han.CFrame*CFrame.new(dbu, 0, -bu)
  125. local h13 = cp(h12, m)
  126. h13.CFrame = han.CFrame*CFrame.new(-bu, 0, dbu)
  127. local h14 = cp(ha1, m)
  128. h14.BrickColor = BrickColor.new("Light orange brown")
  129. h14.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -dbu)
  130. local h15 = cp(h14, m)
  131. h15.CFrame = han.CFrame*CFrame.new(-dbu, 0, xbu(3))
  132. local h16 = cp(ha8, m)
  133. h16.Size = crecxvec(3)
  134. h16.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(3))
  135. local h17 = cp(ha8, m)
  136. h17.Size = creczvec(3)
  137. h17.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, xbu(4))
  138. local h18 = cp(h16, m)
  139. h18.BrickColor = BrickColor.new("Reddish brown")
  140. h18.CFrame = han.CFrame*CFrame.new(dbu, 0, -xbu(3))
  141. local h19 = cp(h17, m)
  142. h19.BrickColor = BrickColor.new("Reddish brown")
  143. h19.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, dbu)
  144. local h20 = cp(h12, m)
  145. h20.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -xbu(3))
  146. local h21 = cp(h12, m)
  147. h21.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, xbu(3))
  148. local h22 = cp(h14, m)
  149. h22.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -xbu(4))
  150. local h23 = cp(h14, m)
  151. h23.CFrame = han.CFrame*CFrame.new(-xbu(4), 0, xbu(3))
  152. local h24 = cp(h14, m)
  153. h24.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(5))
  154. local h25 = cp(h14, m)
  155. h25.CFrame = han.CFrame*CFrame.new(-xbu(5), 0, xbu(4))
  156. local h26 = cp(h12, m)
  157. h26.Size = recxvec
  158. h26.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(6.5))
  159. local h27 = cp(h12, m)
  160. h27.Size = reczvec
  161. h27.CFrame = han.CFrame*CFrame.new(-xbu(6.5), 0, xbu(4))
  162. local h28 = cp(h14, m)
  163. h28.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(8))
  164. local h29 = cp(h14, m)
  165. h29.CFrame = han.CFrame*CFrame.new(-xbu(8), 0, xbu(4))
  166. local h30 = cp(ha8, m)
  167. h30.Size = crecxvec(4)
  168. h30.CFrame = han.CFrame*CFrame.new(xbu(5), 0, -xbu(6.5))
  169. local h31 = cp(ha8, m)
  170. h31.Size = creczvec(4)
  171. h31.CFrame = han.CFrame*CFrame.new(-xbu(6.5), 0, xbu(5))
  172. local h32 = cp(h30, m)
  173. h32.BrickColor = BrickColor.new("Reddish brown")
  174. h32.CFrame = han.CFrame*CFrame.new(xbu(3), 0, -xbu(6.5))
  175. local h33 = cp(h31, m)
  176. h33.BrickColor = BrickColor.new("Reddish brown")
  177. h33.CFrame = han.CFrame*CFrame.new(-xbu(6.5), 0, xbu(3))
  178. local h34 = cp(ha1, m)
  179. h34.BrickColor = BrickColor.new("Reddish brown")
  180. h34.CFrame = han.CFrame*CFrame.new(xbu(4), 0, -xbu(9))
  181. local h35 = cp(h34, m)
  182. h35.CFrame = han.CFrame*CFrame.new(-xbu(9), 0, xbu(4))
  183. local h36 = cp(ha1, m)
  184. h36.BrickColor = BrickColor.new("Dark stone grey")
  185. h36.CFrame = han.CFrame*CFrame.new(xbu(2), 0, -xbu(7))
  186. local h37 = cp(h36, m)
  187. h37.CFrame = han.CFrame*CFrame.new(xbu(1), 0, -xbu(6))
  188. local h38 = cp(h36, m)
  189. h38.CFrame = han.CFrame*CFrame.new(0, 0, -xbu(5))
  190. local h39 = cp(h36, m)
  191. h39.CFrame = han.CFrame*CFrame.new(-xbu(1), 0, -xbu(4))
  192. local h40 = cp(h36, m)
  193. h40.CFrame = han.CFrame*CFrame.new(-xbu(2), 0, -xbu(3))
  194. local h41 = cp(h36, m)
  195. h41.CFrame = han.CFrame*CFrame.new(-xbu(3), 0, -xbu(2))
  196. local h42 = cp(h36, m)
  197. h42.CFrame = han.CFrame*CFrame.new(-xbu(4), 0, -xbu(1))
  198. local h43 = cp(h36, m)
  199. h43.CFrame = han.CFrame*CFrame.new(-xbu(5), 0, 0)
  200. local h44 = cp(h36, m)
  201. h44.CFrame = han.CFrame*CFrame.new(-xbu(6), 0, xbu(1))
  202. local h45 = cp(h36, m)
  203. h45.CFrame = han.CFrame*CFrame.new(-xbu(7), 0, xbu(2))
  204. bowp:add(ha1, ha2, ha3, ha4, ha5, ha6, ha7, ha8, ha9, h10, h11, h12, h13, h14, h15, h16, h17, h18, h19, h20, h21, h22, h23, h24, h25, h26, h27, h28, h29, h30, h31, h32, h33, h34, h35, h36, h37, h38, h39, h40, h41, h42, h43, h44, h45)
  205. for i = 1,#bowp.dat do
  206. local w = Instance.new("Weld", bowp.dat[i])
  207. w.Part0 = han
  208. w.Part1 = bowp.dat[i]
  209. w.C0 = han.CFrame:inverse()
  210. w.C1 = bowp.dat[i].CFrame:inverse()
  211. end
  212. local s1 = Instance.new("Sound", han)
  213. s1.Name = "shotsound"
  214. s1.Pitch = 1.2
  215. s1.SoundId = sid[1]
  216. s1.Volume = 1
  217. local s2 = Instance.new("Sound", han)
  218. s2.Name = "arrowsound"
  219. s2.Pitch = 1.2
  220. s2.Volume = 1
  221. s2.SoundId = sid[2]
  222. rg = Instance.new("Weld", ra)
  223. rg.Name = "RightGripC"
  224. rg.Part0 = ra
  225. rg.Part1 = han
  226. rg.C0 = CFrame.new(0, -.75, 0)
  227. rg.C1 = CFrame.new(0, 0, 0)*CFrame.fromEulerAnglesXYZ(-math.rad(90), -math.rad(90),0)
  228. m.Parent = char
  229. end
  230.  
  231. function removebow()
  232. rg:remove()
  233. rg = nil
  234. m:remove()
  235. han = nil
  236. m = nil
  237. end
  238.  
  239. function carrow(head, ms)
  240. if noarrow then return end
  241. noarrow = true
  242. local un = head.Size.z/2
  243. local am = Instance.new("Model")
  244. am.Name = "Arrow"
  245. local a1 = Instance.new("Part", am)
  246. Instance.new("BlockMesh", a1).Scale = Vector3.new(0, 1, 1)
  247. a1.Name = "shaft"
  248. a1.Transparency = 1
  249. a1.FormFactor = 3
  250. a1.TopSurface = 0
  251. a1.BottomSurface = 0
  252. local a1d1 = Instance.new("Decal", a1)
  253. a1d1.Face = "Right"
  254. a1d1.Texture = mid[1]
  255. local a1d2 = Instance.new("Decal", a1)
  256. a1d2.Face = "Left"
  257. a1d2.Texture = mid[2]
  258. a1.Size = Vector3.new(.2, .6, 2)
  259. a1.CFrame = CFrame.new((head.CFrame).p+Vector3.new(0,(head.Size.y/2)+2, 0), ms)*CFrame.fromEulerAnglesXYZ(0, 0, math.rad(45))
  260. local s2 = han:FindFirstChild("arrowsound")
  261. local s2c = nil
  262. if (s2~=nil) then
  263. s2c = s2:clone()
  264. s2c.Parent = a1
  265. s2c.Pitch = math.random(.8,1.2)
  266. end
  267. local s1 = han:FindFirstChild("shotsound")
  268. if (s1~=nil) then
  269. s1.Pitch = math.random(.8,1.2)
  270. s1:Play()
  271. end
  272. local a2 = a1:clone()
  273. a2.CFrame = a1.CFrame*CFrame.fromEulerAnglesXYZ(0, 0, -math.rad(90))
  274. local we = Instance.new("Weld", a2)
  275. we.Part0 = a1
  276. we.Part1 = a2
  277. we.C0 = a1.CFrame:inverse()
  278. we.C1 = a2.CFrame:inverse()
  279. a2.Parent = am
  280. local a3 = Instance.new("Part", am)
  281. Instance.new("BlockMesh", a3).Scale = Vector3.new(1, 1, 0)
  282. a3.Name = "back"
  283. a3.Transparency = 1
  284. a3.FormFactor = 3
  285. a3.TopSurface = 0
  286. a3.BottomSurface = 0
  287. local a3d = Instance.new("Decal", a3)
  288. a3d.Face = "Front"
  289. a3d.Texture = mid[3]
  290. local a3d = Instance.new("Decal", a3)
  291. a3d.Face = "Back"
  292. a3d.Texture = mid[3]
  293. a3.Size = Vector3.new(.6, .6, .2)
  294. a3.CFrame = a1.CFrame*CFrame.new(0, 0, .9)
  295. local w3 = Instance.new("Weld", a3)
  296. w3.Part0 = a1
  297. w3.Part1 = a3
  298. w3.C0 = a1.CFrame:inverse()
  299. w3.C1 = a3.CFrame:inverse()
  300. local alreadyhit = false
  301. con=a1.Touched:connect(function(hit)
  302. if (hit:IsDescendantOf(p.Character)) then return end
  303. if alreadyhit then
  304. con:disconnect()
  305. return
  306. end
  307. if hit.CanCollide then
  308. if (hit~=head) then
  309. if (hit.Parent~=workspace) then
  310. for _,v in pairs(hit.Parent:GetChildren()) do
  311. if (v:IsA("Humanoid")) then
  312. if (v.Health<(damage+1)) then
  313. hit.Parent:BreakJoints()
  314. local tag1 = Instance.new("StringValue", v)
  315. tag1.Name = "DamageTag"
  316. tag1.Value = p.Name
  317. local tag2 = Instance.new("StringValue", v)
  318. tag2.Name = "WeaponTag"
  319. tag2.Value = "Minecraft Bow"
  320. else
  321. v.Health = v.Health-damage
  322. for i,w in pairs(hit.Parent:GetChildren()) do
  323. if (w:IsA("Part")) then
  324. for j = 1,6 do
  325. local nd = Instance.new("Decal", v)
  326. nd.Texture = mid[6]
  327. nd.Transparency = .5
  328. nd.Face = j-1
  329. coroutine.resume(coroutine.create(function()
  330. wait(.7)
  331. nd:remove()
  332. end))
  333. end
  334. end
  335. end
  336. end
  337. end
  338. end
  339. end
  340. a1.CFrame = CFrame.new((a1.CFrame).p, Vector3.new(a1.CFrame.x, hit.CFrame.y, a1.CFrame.z))
  341. local nw = Instance.new("Weld", a1)
  342. nw.Part0 = hit
  343. nw.Part1 = a1
  344. nw.C0 = hit.CFrame:inverse()
  345. nw.C1 = a1.CFrame:inverse()
  346. coroutine.resume(coroutine.create(function()
  347. wait(10)
  348. am:remove()
  349. end))
  350. if (s2c~=nil) then
  351. s2c:Play()
  352. end
  353. alreadyhit = true
  354. con:disconnect()
  355. end
  356. end
  357. end)
  358. con2=a2.Touched:connect(function(hit)
  359. if (hit:IsDescendantOf(p.Character)) then return end
  360. if alreadyhit then
  361. con2:disconnect()
  362. return
  363. end
  364. if hit.CanCollide then
  365. if (hit~=head) then
  366. if (hit.Parent~=workspace) then
  367. for _,v in pairs(hit.Parent:GetChildren()) do
  368. if (v:IsA("Humanoid")) then
  369. if (v.Health<(damage+1)) then
  370. hit.Parent:BreakJoints()
  371. local tag1 = Instance.new("StringValue", v)
  372. tag1.Name = "DamageTag"
  373. tag1.Value = p.Name
  374. local tag2 = Instance.new("StringValue", v)
  375. tag2.Name = "WeaponTag"
  376. tag2.Value = "Minecraft Bow"
  377. else
  378. v.Health = v.Health-damage
  379. for i,w in pairs(hit.Parent:GetChildren()) do
  380. if (w:IsA("Part")) then
  381. for j = 1,6 do
  382. local nd = Instance.new("Decal", w)
  383. nd.Texture = mid[6]
  384. nd.Transparency = .5
  385. nd.Face = j-1
  386. coroutine.resume(coroutine.create(function()
  387. wait(.7)
  388. nd:remove()
  389. end))
  390. end
  391. end
  392. end
  393. end
  394. end
  395. end
  396. end
  397. a1.CFrame = CFrame.new((a1.CFrame).p, Vector3.new(a1.CFrame.x, hit.CFrame.y, a1.CFrame.z))
  398. local nw = Instance.new("Weld", a1)
  399. nw.Part0 = hit
  400. nw.Part1 = a1
  401. nw.C0 = hit.CFrame:inverse()
  402. nw.C1 = a1.CFrame:inverse()
  403. coroutine.resume(coroutine.create(function()
  404. wait(10)
  405. am:remove()
  406. end))
  407. if (s2c~=nil) then
  408. s2c:Play()
  409. end
  410. alreadyhit = true
  411. con2:disconnect()
  412. end
  413. end
  414. end)
  415. coroutine.resume(coroutine.create(function()
  416. wait(12)
  417. if not alreadyhit then
  418. alreadyhit = true
  419. am:remove()
  420. end
  421. end))
  422. local xr = math.random(velocityMin,velocityMax)
  423. a1.Velocity = a1.CFrame.lookVector*xr
  424. a2.Velocity = a1.CFrame.lookVector*xr
  425. a3.Velocity = a1.CFrame.lookVector*xr
  426. am.Parent = workspace
  427. coroutine.resume(coroutine.create(function()
  428. wait(delayTime)
  429. noarrow = false
  430. end))
  431. end
  432.  
  433. local h = Instance.new("HopperBin", p["Backpack"])
  434. h.Name = "MCBow"
  435. h.TextureId = mid[5]
  436.  
  437. h.Selected:connect(function(mos)
  438. equipped = true
  439. mos.Icon = mid[4]
  440. local hed = p.Character:FindFirstChild("Head")
  441. if (hed==nil) then return end
  442. createbow()
  443. mos.Button1Down:connect(function()
  444. carrow(hed, mos.Hit.p)
  445. end)
  446. h.Deselected:connect(function()
  447. mos.Icon = "rbxasset://textures\\ArrowFarCursor.png"
  448. end)
  449. end)
  450.  
  451. h.Deselected:connect(function()
  452. equipped = false
  453. removebow()
  454. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement