Advertisement
DedFense

(Mine) Vape Pen (LOCAL)

Jun 8th, 2016
2,673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.11 KB | None | 0 0
  1. --LOCAL
  2. --Started on 4/2/2016 12:49Pm
  3. --Ended main creation on 4/3/2016 8:19Am
  4.  
  5. --[[Created by:
  6. Elemental_Code(Animator) and gruntmaster1217(Builder)
  7. ]]--
  8.  
  9. --[[Run this in a server script: require(392895346)]]--
  10. --[[Once it's loaded, just run this as a local and done.]]--
  11.  
  12. --
  13.  
  14.  
  15. local speed = 0.1
  16. local angle = 0
  17. local anglespeed = 2
  18. local armspeed = 0.1
  19. local armangle = 0
  20. local armanglespeed = 2
  21. local legspeed = 0.1
  22. local legangle = 0
  23. local leganglespeed = 2
  24. local sine = 0
  25. local change = .5
  26. action = "Idle"
  27. on = false
  28. enabled = true
  29. damen = false
  30. jumping = false
  31. falling = false
  32.  
  33. combo = 1
  34. plr = game.Players.LocalPlayer
  35. char = plr.Character
  36. human = char.Humanoid
  37. human:ClearAllChildren()
  38. human.WalkSpeed = 3
  39. mouse = plr:GetMouse()
  40. local face = char.Head.face
  41. local tex = face.Texture
  42. local PartColors = {"Black", "Cyan", "Institutional white","Pink","Gold","Dark red","Fossil","Royal purple"}
  43. local ButtonColors = {"White"; "Cyan";}
  44. T = char:findFirstChild("Torso")
  45. Head = char.Head
  46. LA = char:findFirstChild("Left Arm")
  47. RA = char:findFirstChild("Right Arm")
  48. LL = char:findFirstChild("Left Leg")
  49. RL = char:findFirstChild("Right Leg")
  50. LS = T:findFirstChild("Left Shoulder")
  51. RS = T:findFirstChild("Right Shoulder")
  52. LH = T:findFirstChild("Left Hip")
  53. RH = T:findFirstChild("Right Hip")
  54. Neck = T:findFirstChild("Neck")
  55. HM = char:findFirstChild("HumanoidRootPart")
  56. RJ = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  57. WLS = Instance.new("Weld", LA)
  58. WLS.C0 = CFrame.new(-1.5, 0.5, 0)
  59. WLS.C1 = CFrame.new(0, 0.5, 0)
  60. WLS.Part0 = T
  61. WLS.Part1 = LA
  62. WRS = Instance.new("Weld", RA)
  63. WRS.Part0 = T
  64. WRS.Part1 = RA
  65. WRS.C0 = CFrame.new(1.5, 0.5, 0)
  66. WRS.C1 = CFrame.new(0, 0.5, 0)
  67. WLH = LH
  68. WRH = RH
  69. LSC0 = WLS.C0
  70. RSC0 = WRS.C0
  71. LHC0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  72. RHC0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  73. WRJ = Instance.new("Weld", HM)
  74. WRJ.Part0 = T
  75. WRJ.Part1 = HM
  76. WRJ.C0 = CFrame.new()
  77. WRJ.C1 = CFrame.new()
  78. RJC0 = WRJ.C0
  79. NC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  80.  
  81. Run = game:GetService("RunService")
  82.  
  83. game.ReplicatedStorage.VapePen:Clone().Parent = char
  84. vpen = char:WaitForChild("VapePen")
  85. button = vpen.Button
  86. local vweld = Instance.new("Weld", RA)
  87. vweld.Part0 = RA
  88. vweld.Part1 = vpen.MouthPeice
  89. vweld.C0 = CFrame.new(-.2,-1.08,.6) * CFrame.Angles(math.rad(90),math.rad(180),math.rad(0))
  90.  
  91.  
  92.  
  93.  
  94.  
  95. PlaySound = function(part,volume,pitch,id)
  96. local Sound = Instance.new("Sound", part)
  97. Sound.SoundId = id
  98. Sound.Pitch = pitch
  99. Sound.Volume = volume
  100. Sound:Play()
  101. Sound:remove()
  102. end
  103.  
  104. for i,v in pairs(char.Head:GetChildren()) do
  105.  
  106. if v:IsA("Sound") then
  107. v:Destroy()
  108. end
  109. end
  110.  
  111.  
  112.  
  113. function Rwait(long)
  114. if long == 0 or long == nil then
  115. Run.RenderStepped:wait()
  116. else
  117. for i = 0,long do
  118. Run.RenderStepped:wait()
  119. end
  120. end
  121. end
  122.  
  123. function lerp(weld,beglerp,endlerp,speed)
  124. weld.C0 = beglerp:lerp(endlerp,speed)
  125. return weld.C0
  126. end
  127.  
  128.  
  129.  
  130. function Hit()
  131. PlaySound(char.Head, 1, .4, "http://www.roblox.com/asset/?id=163317429")
  132. face.Texture = "http://www.roblox.com/asset/?id=161066584"
  133. human.WalkSpeed = 0
  134. button.Material = "Neon"
  135. vpen.TipPart.Reflectance = 0
  136. for i = 1,45 do
  137.  
  138. lerp(WLS,WLS.C0,LSC0 *CFrame.Angles(math.rad(-20),math.rad(0),-math.rad(20)),.05)
  139. lerp(WRS,WRS.C0,CFrame.new(1.2, 0.5, 0) *CFrame.Angles(math.rad(115.3),-math.rad(30),-math.rad(70)),.05)
  140. lerp(WLH,WLH.C0,LHC0 *CFrame.Angles(-math.rad(2),0,math.rad(15)),.05)
  141. lerp(WRH,WRH.C0,RHC0 *CFrame.Angles(-math.rad(2),0,math.rad(-15)),.05)
  142. lerp(WRJ,WRJ.C0,RJC0 * CFrame.Angles(math.rad(-15), math.rad(0), math.rad(0)),.05)
  143. lerp(Neck,Neck.C0,NC0* CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)),.05)
  144. vweld.C0 = CFrame.new(.2,-1.05,-.1)* CFrame.Angles(math.rad(0),math.rad(-180),math.rad(-70))
  145. Rwait()
  146. end
  147. while button.Material == "Neon" do
  148. wait()
  149. vpen.TipPart.BrickColor = BrickColor.random()
  150. end
  151. end
  152.  
  153.  
  154. function EndHit(time)
  155. for i = 1,25 do
  156. lerp(WLS,WLS.C0,LSC0 *CFrame.new(math.rad(1.5),math.rad(10), math.rad(0)) *CFrame.Angles(-math.rad(-10),0,math.rad(-20)),.05)
  157. lerp(WRS,WRS.C0,RSC0 *CFrame.new(math.rad(1.5),math.rad(10), math.rad(0)) *CFrame.Angles(-math.rad(5),0,math.rad(50)),.008)
  158. lerp(WLH,WLH.C0,LHC0 *CFrame.Angles(-math.rad(7),0,math.rad(-5)),.05)
  159. lerp(WRH,WRH.C0,RHC0 *CFrame.Angles(-math.rad(7),0,math.rad(-5)),.05)
  160. lerp(WRJ,WRJ.C0,RJC0 * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)),.05)
  161. lerp(Neck,Neck.C0,NC0* CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0)),.05)
  162. vweld.C0 = CFrame.new(.1,-1.05,-.15)* CFrame.Angles(math.rad(0),math.rad(-250),math.rad(-90))
  163. Rwait()
  164. end
  165. vpen.TipPart.BrickColor = BrickColor.new("Fossil")
  166. vpen.TipPart.Reflectance = 1
  167. button.Material = "SmoothPlastic"
  168. vpen.TipPart.Material = "SmoothPlastic"
  169. local p = Instance.new("Part", char)
  170. p.Size = Vector3.new(1,1,1)
  171. p.CanCollide = false
  172. p.Anchored = true
  173. p.Transparency = 1
  174. --local pw = Instance.new("Weld", p)
  175. --p.Part0 = p
  176. --p.Part1 = char.Head
  177. Run.RenderStepped:connect(function()
  178. p.CFrame = char.Head.CFrame * CFrame.new(0,.1,-1)*CFrame.Angles(-89.5,0,0)
  179. end)
  180.  
  181. local s = Instance.new("Smoke", p)
  182. s.Opacity = 1
  183. t = time
  184. s.Size = time/100
  185. --s.RiseVelocity = t - 10/2
  186. s.RiseVelocity = 5
  187. if time <10 then
  188. s.RiseVelocity = 5
  189. elseif time >30 then
  190. s.RiseVelocity = 8
  191.  
  192. end
  193. for i = 1,5 do
  194. s.Size = s.Size - .05
  195. end
  196. wait(3)
  197. for i = 1,20 do
  198. s.Opacity = s.Opacity - .1
  199. wait()
  200. end
  201. s:remove()
  202. p:remove()
  203. -- dem:disconnect()
  204. human.WalkSpeed = 3
  205. enabled = true
  206. face.Texture = tex
  207. end
  208. time = 0
  209.  
  210. function Selected()
  211. click = mouse.Button1Down:connect(function()
  212. if combo == 1 and on == true and enabled == true then
  213. enabled = false
  214. Hit()
  215. while enabled == false do
  216. time = time+.1
  217. print(time)
  218. wait()
  219. end
  220. end
  221.  
  222.  
  223. end)
  224. up = mouse.Button1Up:connect(function()
  225. if combo == 1 and on == true and enabled == false then
  226. if time <1 then
  227. enabled = true
  228. human.WalkSpeed = 3
  229. face.Texture = tex
  230. print(time)
  231. else
  232. otime = time
  233. time = 0
  234. EndHit(otime)
  235. enabled = true
  236. end
  237.  
  238. end
  239.  
  240. end)
  241.  
  242. on = true--<<
  243. end
  244.  
  245.  
  246.  
  247. function Deselected()
  248. click:disconnect()
  249. up:disconnect()
  250. end
  251.  
  252. vpen.Battery.BrickColor = BrickColor.new(PartColors[math.random(1,#PartColors)])
  253. vpen.Button.BrickColor = BrickColor.new("Cyan")
  254.  
  255. Selected()
  256.  
  257. plr.Chatted:connect(function(msg)
  258. if msg:sub(0,3) == "/c " then
  259. local newcol = msg:sub(4)
  260. vpen.Battery.BrickColor = BrickColor.new(newcol)
  261. --vpen.Button.BrickColor = BrickColor.new(newcol)
  262. end
  263. end)
  264.  
  265. game:GetService("RunService").RenderStepped:connect(function()
  266. if on == true then
  267. angle = (angle % 100) +anglespeed/10
  268. armangle = (armangle % 100) +armanglespeed/10
  269. legangle = (legangle % 100) +leganglespeed/10
  270. sine = sine + change
  271. if action == "Idle" and enabled == true then
  272. lerp(WLS,WLS.C0,LSC0 *CFrame.new(math.rad(1.5),math.cos(sine/14)*math.rad(-4), math.rad(0)) *CFrame.Angles(-math.rad(5),0,math.rad(-10)),.05)
  273. lerp(WRS,WRS.C0,RSC0 *CFrame.new(math.rad(1.5),math.cos(sine/14)*math.rad(-4), math.rad(0)) *CFrame.Angles(-math.rad(5),0,math.rad(10)),.05)
  274. lerp(WLH,WLH.C0,LHC0 *CFrame.Angles(-math.rad(7),0,math.cos(sine/14)*-.02),.05)
  275. lerp(WRH,WRH.C0,RHC0 *CFrame.Angles(-math.rad(7),0,math.cos(sine/14)*.02),.05)
  276. lerp(WRJ,WRJ.C0,RJC0 *CFrame.new(0,0,0)*CFrame.Angles(math.cos(sine/14)*.02,.25,0),.05)
  277. lerp(Neck,Neck.C0,NC0*CFrame.Angles(math.rad(0),math.rad(0),math.rad(10)),speed)--Was 30
  278. vweld.C0 = CFrame.new(-.2,-1.08,.6) * CFrame.Angles(math.rad(90),math.rad(180),math.rad(0))
  279.  
  280. end
  281. if action == "Walk" and enabled == true then
  282. lerp(WLS,WLS.C0,LSC0 *CFrame.Angles(math.cos(sine/5)*-math.rad(30),0,math.rad(-10)),.3)
  283. lerp(WRS,WRS.C0,RSC0 *CFrame.Angles(math.cos(sine/5)*-math.rad(-30),0,math.rad(10)),.3)
  284. lerp(WLH,WLH.C0,LHC0 *CFrame.Angles(-math.rad(3.5),0,math.cos(sine/5)*-math.rad(30)),.7)
  285. lerp(WRH,WRH.C0,RHC0 *CFrame.Angles(-math.rad(3.5),0,math.cos(sine/5)*-math.rad(30)),.7)
  286. lerp(WRJ,WRJ.C0,RJC0 *CFrame.Angles(math.rad(5),math.rad(360),math.rad(360)),speed)
  287. vweld.C0 = CFrame.new(-.2,-1.08,.6) * CFrame.Angles(math.rad(90),math.rad(180),math.rad(0))
  288. lerp(Neck,Neck.C0,NC0,speed)
  289. end
  290. if HM.Velocity.Y >= 1 and enabled == true then
  291. action = "Jump"
  292. jumping = true
  293. lerp(WLS,WLS.C0,LSC0 *CFrame.Angles(-math.rad(25),0,0),armspeed)
  294. lerp(WRS,WRS.C0,RSC0 *CFrame.Angles(math.rad(25),0,0),armspeed)
  295. lerp(WLH,WLH.C0,LHC0 *CFrame.Angles(0,0,math.rad(20)),legspeed)
  296. lerp(WRH,WRH.C0,RHC0 *CFrame.Angles(0,0,-math.rad(20)),legspeed)
  297. lerp(WRJ,WRJ.C0,RJC0,speed)
  298. lerp(Neck,Neck.C0,NC0 *CFrame.Angles(-math.pi/8,0,0),speed)
  299. vweld.C0 = CFrame.new(-.2,-1.08,.6) * CFrame.Angles(math.rad(90),math.rad(180),math.rad(0))
  300. Rwait()
  301. end
  302. if HM.Velocity.Y <= -1 and enabled == true then
  303. action = "Fall"
  304. falling = true
  305. lerp(WLS,WLS.C0,LSC0 *CFrame.Angles(math.rad(10),0,-20),armspeed)
  306. lerp(WRS,WRS.C0,RSC0 *CFrame.Angles(math.rad(10),0,20),armspeed)
  307. lerp(WLH,WLH.C0,LHC0 *CFrame.Angles(0,0,math.rad(20)),legspeed)
  308. lerp(WRH,WRH.C0,RHC0 *CFrame.new(math.rad(90), math.rad(90), math.rad(0))*CFrame.Angles(0,0,math.cos(20)),.05)
  309. lerp(WRJ,WRJ.C0,RJC0 *CFrame.Angles(math.pi/20,0,0),speed)
  310. lerp(Neck,Neck.C0,NC0*CFrame.Angles(math.cos(70),0,0),speed)
  311. vweld.C0 = CFrame.new(-.2,-1.08,.6) * CFrame.Angles(math.rad(90),math.rad(180),math.rad(0))
  312. Rwait()
  313. end
  314. if Vector3.new(T.Velocity.X,0,T.Velocity.Z).magnitude <= 2 then
  315. action = "Idle"
  316. elseif Vector3.new(T.Velocity.X,0,T.Velocity.Z).magnitude <= 20 then
  317. action = "Walk"
  318. end
  319. end
  320. Rwait()
  321.  
  322. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement