Advertisement
naser2345

Roblox Leaf blower script

Sep 2nd, 2016
5,401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.29 KB | None | 0 0
  1. repeat wait() until game:service'Players'.LocalPlayer.Character
  2. --[[
  3.  
  4. - Added new color scheme.
  5. - Some minor edits.
  6. - New engine type, for your faster speed requirements.
  7. - Camera bug fix.
  8. ]]--
  9. do --CFrame lerp
  10. local function QuaternionFromCFrame(cf)
  11. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  12. local trace = m00 + m11 + m22
  13. if trace > 0 then
  14. local s = math.sqrt(1 + trace)
  15. local recip = 0.5/s
  16. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  17. else
  18. local i = 0
  19. if m11 > m00 then
  20. i = 1
  21. end
  22. if m22 > (i == 0 and m00 or m11) then
  23. i = 2
  24. end
  25. if i == 0 then
  26. local s = math.sqrt(m00-m11-m22+1)
  27. local recip = 0.5/s
  28. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  29. elseif i == 1 then
  30. local s = math.sqrt(m11-m22-m00+1)
  31. local recip = 0.5/s
  32. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  33. elseif i == 2 then
  34. local s = math.sqrt(m22-m00-m11+1)
  35. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  36. end
  37. end
  38. end
  39. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  40. local xs, ys, zs = x + x, y + y, z + z
  41. local wx, wy, wz = w*xs, w*ys, w*zs
  42. local xx = x*xs
  43. local xy = x*ys
  44. local xz = x*zs
  45. local yy = y*ys
  46. local yz = y*zs
  47. local zz = z*zs
  48. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  49. end
  50. local function QuaternionSlerp(a, b, t)
  51. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  52. local startInterp, finishInterp;
  53. if cosTheta >= 0.0001 then
  54. if (1 - cosTheta) > 0.0001 then
  55. local theta = math.acos(cosTheta)
  56. local invSinTheta = 1/math.sin(theta)
  57. startInterp = math.sin((1-t)*theta)*invSinTheta
  58. finishInterp = math.sin(t*theta)*invSinTheta
  59. else
  60. startInterp = 1-t
  61. finishInterp = t
  62. end
  63. else
  64. if (1+cosTheta) > 0.0001 then
  65. local theta = math.acos(-cosTheta)
  66. local invSinTheta = 1/math.sin(theta)
  67. startInterp = math.sin((t-1)*theta)*invSinTheta
  68. finishInterp = math.sin(t*theta)*invSinTheta
  69. else
  70. startInterp = t-1
  71. finishInterp = t
  72. end
  73. end
  74. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  75. end
  76. function clerp(a,b,t)
  77. local qa = {QuaternionFromCFrame(a)}
  78. local qb = {QuaternionFromCFrame(b)}
  79. local ax, ay, az = a.x, a.y, a.z
  80. local bx, by, bz = b.x, b.y, b.z
  81. local _t = 1-t
  82. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  83. end
  84.  
  85. end
  86.  
  87. plr = game:service'Players'.LocalPlayer
  88. char = plr.Character
  89. mouse = plr:GetMouse()
  90. humanoid = char:findFirstChild("Humanoid")
  91. torso = char:findFirstChild("Torso")
  92. head = char.Head
  93. ra = char:findFirstChild("Right Arm")
  94. la = char:findFirstChild("Left Arm")
  95. rl = char:findFirstChild("Right Leg")
  96. ll = char:findFirstChild("Left Leg")
  97. rs = torso:findFirstChild("Right Shoulder")
  98. ls = torso:findFirstChild("Left Shoulder")
  99. rh = torso:findFirstChild("Right Hip")
  100. lh = torso:findFirstChild("Left Hip")
  101. neck = torso:findFirstChild("Neck")
  102. rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  103. anim = char:findFirstChild("Animate")
  104. rootpart = char:findFirstChild("HumanoidRootPart")
  105. camera = workspace.CurrentCamera
  106. modelforparts = char:findFirstChild("ModelForParts") or Instance.new("Model", char)
  107. modelforparts.Name = "ModelForParts"
  108. equipped = false
  109. local MAXSPEED = 90
  110. local SPEED = 0
  111. bg = Instance.new("BodyGyro")
  112. bg.maxTorque = Vector3.new(9e6,9e6,9e6)
  113. bg.D = 800
  114. bv = Instance.new("BodyVelocity")
  115. bv.maxForce = Vector3.new(9e6,9e6,9e6)
  116.  
  117. local sound = Instance.new("Sound", head)
  118. sound.Volume = 1
  119. sound.Pitch = 2
  120. sound.SoundId = "http://www.roblox.com/asset/?id=142782429"
  121. sound.Looped = true
  122. wait()
  123. sound:play()
  124.  
  125.  
  126. ColorScheme1 = BrickColor.new(106)
  127. ColorScheme2 = BrickColor.new(40)
  128. ColorScheme3 = BrickColor.new(199)
  129. ANGLE = 0
  130. equipped = true
  131.  
  132. rs.Parent = nil
  133. ls.Parent = nil
  134. rh.Parent = nil
  135. lh.Parent = nil
  136. anim.Parent = nil
  137. wait()
  138. local rm = Instance.new("Weld", modelforparts)
  139. rm.C0 = CFrame.new(1.5, 0.5, 0)
  140. rm.C1 = CFrame.new(0, 0.5, 0)
  141. rm.Part0 = torso
  142. rm.Part1 = ra
  143. local lm = Instance.new("Weld", modelforparts)
  144. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  145. lm.C1 = CFrame.new(0, 0.5, 0)
  146. lm.Part0 = torso
  147. lm.Part1 = la
  148. local rlegm = Instance.new("Weld", modelforparts)
  149. rlegm.C0 = CFrame.new(0.5, -1, 0)
  150. rlegm.C1 = CFrame.new(0, 1, 0)
  151. rlegm.Part0 = torso
  152. rlegm.Part1 = rl
  153. local llegm = Instance.new("Weld", modelforparts)
  154. llegm.C0 = CFrame.new(-0.5, -1, 0)
  155. llegm.C1 = CFrame.new(0, 1, 0)
  156. llegm.Part0 = torso
  157. llegm.Part1 = ll
  158.  
  159. --grey part
  160. local part = Instance.new("Part", modelforparts)
  161. part.Size = Vector3.new(2.2, .85, 2.2)
  162. part.FormFactor = 'Custom'
  163. part.BrickColor = ColorScheme3
  164. part.Locked = true
  165. part.TopSurface = 10
  166. part.BottomSurface = 10
  167. part.LeftSurface = 10
  168. part.RightSurface = 10
  169. part.FrontSurface = 10
  170. part.BackSurface = 10
  171. part:breakJoints()
  172. part.Material = "SmoothPlastic"
  173. part.CanCollide = false
  174. Instance.new("CylinderMesh", part)
  175. local weld = Instance.new("Weld", part)
  176. weld.Part0 = part
  177. weld.Part1 = torso
  178. weld.C1 = CFrame.new(0, -2.1, 0)
  179. weld.C0 = CFrame.Angles(math.pi/2, math.pi/2, 0) * CFrame.new(0, 0, .95)
  180. --orange part
  181. local part2 = part:clone()
  182. part2.Parent = modelforparts
  183. part2.Size = Vector3.new(2.5, 1.05, 2.5)
  184. part2.BrickColor = ColorScheme1
  185. local wld2 = Instance.new("Weld", part)
  186. wld2.Part0 = part2
  187. wld2.Part1 = part
  188. wld2.C1 = CFrame.new()
  189. wld2.C0 = CFrame.new()
  190. --white part
  191. local part3 = part:clone()
  192. part3.Parent = modelforparts
  193. part3.Size = Vector3.new(2.62, .5, 2.62)
  194. part3.BrickColor = ColorScheme2
  195. local wld3 = Instance.new("Weld", part)
  196. wld3.Part0 = part3
  197. wld3.Part1 = part
  198. wld3.C1 = CFrame.new()
  199. wld3.C0 = CFrame.new()
  200. --airblower
  201. local airblowercyl = part:clone()
  202. airblowercyl.Parent = modelforparts
  203. airblowercyl.Size = Vector3.new(.95, 3.5, .95)
  204. airblowercyl.BrickColor = ColorScheme3
  205. local smoke = Instance.new("Smoke", airblowercyl)
  206. smoke.Color = Color3.new(.3, .3, .3)
  207. smoke.RiseVelocity = 10
  208. smoke.Opacity = .1
  209. local cwld = Instance.new("Weld", airblowercyl)
  210. cwld.Part0 = airblowercyl
  211. cwld.Part1 = part
  212. cwld.C1 = CFrame.Angles(0, 0, -math.pi/2)
  213. cwld.C0 = CFrame.new(0, -1.85-0.925, -.6) * CFrame.Angles(math.pi/14, 0, 0)
  214.  
  215. --handles
  216. local hndl = part:clone()
  217. hndl.Parent = modelforparts
  218. hndl.Size = Vector3.new(.2, .4, .2)
  219. hndl.BrickColor = BrickColor.new(26)
  220. hndl.Mesh:Destroy()
  221. local hwld = Instance.new("Weld", hndl)
  222. hwld.Part1 = part
  223. hwld.Part0 = hndl
  224. hwld.C1 = CFrame.new(.1, 0, 0) * CFrame.Angles(math.pi/2, 0, 0)
  225. hwld.C0 = CFrame.new(0, -.82 - .4, 0)
  226. Instance.new("BlockMesh", hndl).Scale = Vector3.new(.5, 1, .5)
  227. local hndl2 = hndl:clone()
  228. hndl2.Parent = modelforparts
  229. hndl2.Size = Vector3.new(.8, .2, .2)
  230. local hwld2 = Instance.new("Weld", hndl2)
  231. hwld2.Part0 = hndl2
  232. hwld2.Part1 = part
  233. hwld2.C1 = CFrame.new(-.25, 0, 0) * CFrame.Angles(math.pi/2, 0, 0)
  234. hwld2.C0 = CFrame.new(0, -1 - .4, 0)
  235. hndl2.Mesh.Scale = Vector3.new(1, .5, .5)
  236. local hndl3 = hndl:clone()
  237. hndl3.Parent = modelforparts
  238. hndl3.Size = Vector3.new(.2, .4, .2)
  239. local hwld3 = Instance.new("Weld", hndl3)
  240. hwld3.Part0 = hndl3
  241. hwld3.Part1 = part
  242. hwld3.C1 = CFrame.new(-.6, 0, 0) * CFrame.Angles(math.pi/2, 0, 0)
  243. hwld3.C0 = CFrame.new(0, -.82 - .4, 0)
  244. --balloon ropes
  245. local blnrope = part:clone()
  246. blnrope.Parent = modelforparts
  247. blnrope.Size = Vector3.new(.2, 3.8, .2)
  248. blnrope.BrickColor = BrickColor.new(1)
  249. blnrope.Mesh:Destroy()
  250. local blnwld = Instance.new("Weld", blnrope)
  251. blnwld.Part0 = blnrope
  252. blnwld.Part1 = airblowercyl
  253. blnwld.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.pi/2, math.pi/7, -math.pi/8)
  254. blnwld.C0 = CFrame.new(0, -2, 0)
  255. Instance.new("BlockMesh", blnrope).Scale = Vector3.new(.2, 1, .2)
  256. local blnrope2 = blnrope:clone()
  257. blnrope2.Parent = modelforparts
  258. blnrope2.Size = Vector3.new(.2, 4, .2)
  259. local blnwld2 = Instance.new("Weld", blnrope2)
  260. blnwld2.Part0 = blnrope2
  261. blnwld2.Part1 = airblowercyl
  262. blnwld2.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.pi/2, math.pi/4, -math.pi/74)
  263. blnwld2.C0 = CFrame.new(0, -2.2, 0)
  264. local blnrope3 = blnrope:clone()
  265. blnrope3.Parent = modelforparts
  266. local blnwld3 = Instance.new("Weld", blnrope3)
  267. blnwld3.Part0 = blnrope3
  268. blnwld3.Part1 = airblowercyl
  269. blnwld3.C0 = CFrame.new(0, -2, 0)
  270.  
  271.  
  272. --Stored balloon rope welds
  273. blnwldC1 = blnwld.C1
  274. blnwld2C1 = blnwld2.C1
  275. blnwld3C1 = blnwld3.C1
  276. --balloons
  277. local bln = part:clone()
  278. bln.Parent = modelforparts
  279. bln.Size = Vector3.new(1.65, 1.8, 1.65)
  280. bln.BrickColor = BrickColor.new(119)
  281. bln.Mesh:Destroy()
  282. bln.Transparency = .1
  283. local balnwld = Instance.new("Weld", bln)
  284. balnwld.Part0 = bln
  285. balnwld.Part1 = blnrope
  286. balnwld.C1 = CFrame.new(0, 0, 0)
  287. balnwld.C0 = CFrame.new(0, -2.6, 0)
  288. Instance.new("SpecialMesh", bln).MeshType = "Sphere"
  289. local bln2 = bln:clone()
  290. bln2.Parent = modelforparts
  291. bln2.BrickColor = BrickColor.new(23)
  292. local balnwld2 = Instance.new("Weld", bln2)
  293. balnwld2.Part0 = bln2
  294. balnwld2.Part1 = blnrope2
  295. balnwld2.C1 = CFrame.new(0, 0, 0)
  296. balnwld2.C0 = CFrame.new(0, -2.8, 0)
  297. local bln3 = bln:clone()
  298. bln3.Parent = modelforparts
  299. bln3.BrickColor = BrickColor.new(21)
  300. local balnwld3 = Instance.new("Weld", bln3)
  301. balnwld3.Part0 = bln3
  302. balnwld3.Part1 = blnrope3
  303. balnwld3.C0 = CFrame.new(0, -2.6, 0)
  304.  
  305. --Controls
  306. bg.Parent = rootpart
  307. bv.Parent = rootpart
  308. forwards = false
  309. backwards = false
  310. mouse.KeyDown:connect(function(k)
  311. if k == "w" then
  312. forwards = true
  313. coroutine.wrap(function()
  314. while forwards do wait()
  315. if SPEED >= MAXSPEED then SPEED = MAXSPEED forwards = false break end
  316. sound.Volume = sound.Volume + .05
  317. if sound.Volume >= .5 then sound.Volume = .5 end
  318. SPEED = SPEED + 5
  319. end
  320. end)()
  321. end
  322. end)
  323. mouse.KeyUp:connect(function(k)
  324. if k == "w" then
  325. forwards = false
  326. coroutine.wrap(function()
  327. while SPEED >= 0 do wait()
  328. sound.Volume = sound.Volume - .05
  329. if sound.Volume <= 0.25 then sound.Volume = 0.25 end
  330. SPEED = SPEED - 5
  331. if forward then break end
  332. if SPEED <= 0 then SPEED = 0 break end
  333. end
  334. end)()
  335. end
  336. end)
  337. --BALLONS MOOOOVEEE :DDD
  338. game:service'RunService'.RenderStepped:connect(function()
  339. if not equipped then return end
  340. blnwldC1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.pi/2 - math.rad(SPEED/1.7) + math.sin(ANGLE)*.025, math.pi/7 + math.sin(ANGLE)*.105, -math.pi/8 - math.sin(ANGLE)*.018)
  341. blnwld2C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.pi/2 - math.rad(SPEED/1.7) + math.sin(ANGLE)*.015, math.pi/4 - math.sin(ANGLE)*.065, -math.pi/74 + math.sin(ANGLE)*.021)
  342. blnwld3C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.pi/2 - math.rad(SPEED/1.7) - math.sin(ANGLE)*.02, math.pi/16 - math.sin(ANGLE)*.125, math.pi/9 - math.sin(ANGLE)*.078)
  343. blnwld.C1 = clerp(blnwld.C1, blnwldC1, 0.05)
  344. blnwld2.C1 = clerp(blnwld2.C1, blnwld2C1, 0.05)
  345. blnwld3.C1 = clerp(blnwld3.C1, blnwld3C1, 0.05)
  346. end)
  347.  
  348. --positioning welds
  349. lm.C0 = CFrame.new(-1.25, .05, -.5) * CFrame.Angles(math.rad(35), 0, math.rad(45))
  350. rm.C0 = CFrame.new(1.25, .05, -.5) * CFrame.Angles(math.rad(35), 0, -math.rad(45))
  351. llegm.C0 = CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, -math.rad(15))
  352. rlegm.C0 = CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(15))
  353.  
  354.  
  355.  
  356. game:service'RunService'.RenderStepped:connect(function()
  357. for i,v in pairs(torso:children()) do if v and v:IsA'BodyGyro' then v:Destroy() end end
  358. ANGLE = (ANGLE % 360) + math.random(1, 10)/100
  359. humanoid.PlatformStand = true
  360. local rotpos = Vector3.new(camera.CoordinateFrame.x, camera.CoordinateFrame.y, camera.CoordinateFrame.z)
  361. bg.cframe = CFrame.new(torso.Position,rotpos) * CFrame.Angles(0, math.pi, 0)
  362. bv.velocity = (torso.CFrame * CFrame.Angles(math.pi/14, 0, 0)).lookVector * SPEED
  363. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement