Advertisement
mathmasterphil

Untitled

Feb 1st, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.92 KB | None | 0 0
  1. Plrs = game:GetService("Players")
  2.  
  3. Name = “mathmasterphil”
  4. me = Plrs[Name]
  5. char = me.Character
  6. Modelname = "xBow"
  7. Toolname = "Bowx"
  8. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  9. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  10. selected = false
  11. Hurt = false
  12. Deb = true
  13. Able = true
  14. Prop = {Damage = 30}
  15.  
  16. ToolIcon = ""
  17. MouseIc = ""
  18. MouseDo = ""
  19.  
  20. Add = {
  21. Sphere = function(P)
  22. local m = Instance.new("SpecialMesh",P)
  23. m.MeshType = "Sphere"
  24. return m
  25. end,
  26. BF = function(P)
  27. local bf = Instance.new("BodyForce",P)
  28. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  29. return bf
  30. end,
  31. BP = function(P)
  32. local bp = Instance.new("BodyPosition",P)
  33. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  34. bp.P = 14000
  35. return bp
  36. end,
  37. BG = function(P)
  38. local bg = Instance.new("BodyGyro",P)
  39. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  40. bg.P = 14000
  41. return bg
  42. end,
  43. Mesh = function(P, ID, x, y, z)
  44. local m = Instance.new("SpecialMesh")
  45. m.MeshId = ID
  46. m.Scale = Vector3.new(x, y, z)
  47. m.Parent = P
  48. return m
  49. end,
  50. Sound = function(P, ID, vol, pitch)
  51. local s = Instance.new("Sound")
  52. s.SoundId = ID
  53. s.Volume = vol
  54. s.Pitch = pitch
  55. s.Parent = P
  56. return s
  57. end
  58. }
  59.  
  60. function find(tab, arg)
  61. local ah = nil
  62. for i,v in pairs(tab) do
  63. if v == arg then
  64. ah = v
  65. end
  66. end
  67. return ah
  68. end
  69.  
  70. function getAllParts(from)
  71. local t = {}
  72. function getParts(where)
  73. for i, v in pairs(where:children()) do
  74. if v:IsA("BasePart") then
  75. if v.Parent ~= char and v.Parent.Parent ~= char then
  76. table.insert(t, v)
  77. end
  78. end
  79. getParts(v)
  80. end
  81. end
  82. getParts(workspace)
  83. return t
  84. end
  85.  
  86. function RayCast(pos1, pos2, maxDist, forward)
  87. local list = getAllParts(workspace)
  88. local pos0 = pos1
  89. for dist = 1, maxDist, forward do
  90. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
  91. for _, v in pairs(list) do
  92. local pos3 = v.CFrame:pointToObjectSpace(pos0)
  93. local s = v.Size
  94. if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) and v.CanCollide == true then
  95. return pos0, v
  96. end
  97. end
  98. end
  99. return pos0, nil
  100. end
  101.  
  102. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  103. local p = Instance.new("Part")
  104. p.formFactor = "Custom"
  105. p.Anchored = Anchor
  106. p.CanCollide = Collide
  107. p.Transparency = Tran
  108. p.Reflectance = Ref
  109. p.BrickColor = BrickColor.new(Color)
  110. for _, Surf in pairs(Surfaces) do
  111. p[Surf] = "Smooth"
  112. end
  113. p.Size = Vector3.new(X, Y, Z)
  114. if Break then
  115. p:BreakJoints()
  116. else p:MakeJoints() end
  117. p.Parent = Parent
  118. return p
  119. end
  120.  
  121. function Weld(p0, p1, x, y, z, a, b, c)
  122. local w = Instance.new("Weld")
  123. w.Parent = p0
  124. w.Part0 = p0
  125. w.Part1 = p1
  126. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  127. return w
  128. end
  129.  
  130. function ComputePos(pos1, pos2)
  131. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  132. return CFrame.new(pos1, pos3)
  133. end
  134.  
  135. function getHumanoid(c)
  136. local h = nil
  137. for i,v in pairs(c:children()) do
  138. if v:IsA("Humanoid") and c ~= char then
  139. if v.Health > 0 then
  140. h = v
  141. end
  142. end
  143. end
  144. return h
  145. end
  146.  
  147. for i,v in pairs(char:children()) do
  148. if v.Name == Modelname then
  149. v:remove()
  150. end
  151. end
  152.  
  153. torso = char.Torso
  154. neck = torso.Neck
  155. hum = char.Humanoid
  156. Rarm = char["Right Arm"]
  157. Larm = char["Left Arm"]
  158. Rleg = char["Right Leg"]
  159. Lleg = char["Left Leg"]
  160.  
  161. hc = Instance.new("Humanoid")
  162. hc.Health = 0
  163. hc.MaxHealth = 0
  164.  
  165. slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.8)
  166. hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6)
  167. charge = Add.Sound(nil, "http://www.roblox.com/asset/?id=2101137", 0.8, 0.65)
  168. boom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2691586", 0.8, 0.3)
  169. smashsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2692806", 0.8, 0.35)
  170. boomboom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2760979", 1, 0.18)
  171.  
  172. function PlaySound(sound, pitch, vol)
  173. local s = sound:clone()
  174. if pitch ~= nil then
  175. if tonumber(pitch) then
  176. s.Pitch = tonumber(pitch)
  177. end
  178. end
  179. if vol ~= nil then
  180. if tonumber(vol) then
  181. s.Volume = tonumber(vol)
  182. end
  183. end
  184. s.Parent = torso
  185. s.PlayOnRemove = true
  186. coroutine.resume(coroutine.create(function()
  187. wait()
  188. s:remove()
  189. end))
  190. end
  191.  
  192. Mo = Instance.new("Model")
  193. Mo.Name = Modelname
  194.  
  195. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  196. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  197. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  198. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  199.  
  200. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  201. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  202. RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  203. LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  204.  
  205. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  206. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  207. RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  208. LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  209.  
  210. HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  211. HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
  212. HW = Weld(HB, nil, 0, -1.3, 0, math.pi/2, 0, 0)
  213.  
  214. TH = Weld(torso, nil, -0.8, 0.4, -0.4, 0, math.pi/2, math.rad(80))
  215. THMain = TH.C1
  216.  
  217. RAWStand, LAWStand, RLWStand, LLWStand, HWStand, NeckStand = nil
  218.  
  219. handle = Part(Mo, false, false, 0, 0, GuitarColour, 0.6, 1.5, 1.5, true)
  220. handle.Name = "Handle"
  221.  
  222. Mo.Parent = char
  223. TH.Part1 = handle
  224.  
  225. if script.Parent.className ~= "HopperBin" then
  226. h = Instance.new("HopperBin",me.Backpack)
  227. h.Name = Toolname
  228. h.TextureId = ToolIcon
  229. script.Parent = h
  230. end
  231.  
  232. bin = script.Parent
  233.  
  234. function detach(bool)
  235. LLW.C0 = CFrame.new(0, 0, 0)
  236. RLW.C0 = CFrame.new(0, 0, 0)
  237. LAW.C0 = CFrame.new(0, 0, 0)
  238. RAW.C0 = CFrame.new(0, 0, 0)
  239. if bool then
  240. LLW.Part1 = nil
  241. RLW.Part1 = nil
  242. RAW.Part1 = nil
  243. LAW.Part1 = nil
  244. end
  245. end
  246.  
  247. function attach()
  248. RAW.Part1 = Rarm
  249. LAW.Part1 = Larm
  250. RLW.Part1 = Rleg
  251. LLW.Part1 = Lleg
  252. end
  253.  
  254. function normal()
  255. neck.C0 = necko
  256. RAW.C0 = RAWStand
  257. LAW.C0 = LAWStand
  258. RLW.C0 = RLWStand
  259. LLW.C0 = LLWStand
  260. RAW.C1 = CFrame.new(0, 0.5, 0)
  261. LAW.C1 = CFrame.new(0, 0.5, 0)
  262. RLW.C1 = CFrame.new(0, 0.8, 0)
  263. LLW.C1 = CFrame.new(0, 0.8, 0)
  264. HW.C0 = HWStand
  265. end
  266.  
  267. function idleanim()
  268. attach()
  269. for i = 0, 1, 0.03 do
  270. RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
  271. LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
  272. RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
  273. LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
  274. neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
  275. if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
  276. wait()
  277. end
  278. wait()
  279. for i = 1, 0, -0.02 do
  280. RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
  281. LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
  282. RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
  283. LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
  284. neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
  285. if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
  286. wait()
  287. end
  288. normal()
  289. end
  290.  
  291. function runanim()
  292. RLW.Part1 = nil
  293. LLW.Part1 = nil
  294. end
  295.  
  296. --[[coroutine.resume(coroutine.create(function()
  297. while true do
  298. wait()
  299. if selected and Able == true then
  300. if torso.Velocity.magnitude < 2 then
  301. idleanim()
  302. wait()
  303. else
  304. runanim()
  305. wait()
  306. end
  307. end
  308. end
  309. end))]]
  310.  
  311. function selectanim()
  312. if RAWStand == nil then
  313. RAWStand = RAW.C0
  314. LAWStand = LAW.C0
  315. RLWStand = RLW.C0
  316. LLWStand = LLW.C0
  317. HWStand = HW.C0
  318. NeckStand = neck.C0
  319. end
  320. end
  321.  
  322. function deselanim()
  323. neck.C0 = necko
  324. detach(true)
  325. end
  326.  
  327.  
  328. function select(mouse)
  329. selectanim()
  330. selected = true
  331. mouse.KeyDown:connect(function(key)
  332. key = key:lower()
  333. if key == "q" then
  334. end
  335. end)
  336. mouse.Button1Down:connect(function()
  337. end)
  338. end
  339.  
  340. function deselect(mouse)
  341. selected = false
  342. deselanim()
  343. end
  344.  
  345. bin.Selected:connect(select)
  346. bin.Deselected:connect(deselect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement