Guest User

Script I need to be FE

a guest
Jun 2nd, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.08 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. repeat wait() until plr.Character
  3. local character = plr.Character
  4. local mouse = plr:GetMouse()
  5. local tool = script.Parent
  6. local ls = "LightSaberModel"
  7. -------------------------------------------------------------------------------------
  8. local poseanim = Instance.new("Animation")
  9. poseanim.AnimationId = "http://www.roblox.com/Asset/?ID=469598483" -- Change the ID here with your own. "http://www.roblox.com/Asset/?ID=YourID"
  10. local pose = character.Humanoid:LoadAnimation(poseanim)
  11.  
  12. local equipanim = Instance.new("Animation")
  13. equipanim.AnimationId = "http://www.roblox.com/Asset/?ID=469603118" -- Change the ID here with your own. "http://www.roblox.com/Asset/?ID=YourID"
  14. local equip = character.Humanoid:LoadAnimation(equipanim)
  15.  
  16. local block1anim = Instance.new("Animation")
  17. block1anim.AnimationId = "http://www.roblox.com/Asset/?ID=469598059" -- Change the ID here with your own. "http://www.roblox.com/Asset/?ID=YourID"
  18. local block1 = character.Humanoid:LoadAnimation(block1anim)
  19.  
  20. local stunanim = Instance.new("Animation")
  21. stunanim.AnimationId = "http://www.roblox.com/Asset/?ID=469598670" -- Change the ID here with your own. "http://www.roblox.com/Asset/?ID=YourID"
  22. local stun = character.Humanoid:LoadAnimation(stunanim)
  23. -------------------------------------------------------------------------------------
  24. local enabled = false
  25.  
  26. local active = false
  27. local activating = false
  28.  
  29. local attacking = false
  30. local canattack = false
  31. local candamage = false
  32. local jumping = false
  33. local forceactive = false
  34.  
  35. local blocking = false
  36. local canblock = false
  37.  
  38. local timer = 0
  39. local direction = 0
  40. local hitcounter = 0
  41. local stamina = 200
  42. -------------------------------------------------------------------------------------
  43. function UpdateStamina()
  44. if stamina <= 0 and character:FindFirstChild(ls) and active then
  45. attacking = false
  46. candamage = false
  47. canattack = false
  48. if character.Humanoid:FindFirstChild("Block") then
  49. character.Humanoid:FindFirstChild("Block"):Remove()
  50. end
  51. block1:Stop()
  52. local saber = character:FindFirstChild(ls)
  53. saber.Blade.CanClash.Value = false
  54. local sound = saber.Blade:FindFirstChild("slash")
  55. sound.Pitch = math.random(95,110)/100
  56. sound:Play()
  57. blocking = false
  58. canattack = true
  59. canblock = true
  60. end
  61. while (blocking == false and enabled and stamina < 200) and character:FindFirstChild(ls) do
  62. stamina = stamina + 2
  63. wait()
  64. end
  65. end
  66.  
  67. function WeldParts(b)
  68. local saber = game.Lighting:FindFirstChild(ls):Clone()
  69. saber.Parent = character
  70. local a = saber.Handle
  71. local w = Instance.new("Weld")
  72. w.Name = "SaberWeld"
  73. w.Parent = a
  74. w.Part0 = b
  75. w.Part1 = a
  76. w.C0 = CFrame.new(0,-1,0) * CFrame.fromEulerAnglesXYZ(math.rad(90),math.rad(180),math.rad(180))
  77. end
  78.  
  79. function OnTouch(p)
  80. if candamage == true then
  81. local mySaber = character:FindFirstChild(ls)
  82. local theirSaber = p.Parent.Parent:FindFirstChild(ls)
  83. if (p.Name == "Blade" or p.Name == "Blade2") then
  84. if p:FindFirstChild("CanClash").Value == true then
  85. local function AddEffect(name,parent,duration)
  86. local effect = game.ReplicatedStorage[name]:Clone()
  87. effect.Parent = parent
  88. game.Debris:AddItem(effect,duration)
  89. end
  90. candamage = false
  91. local SoundList = {"hit1","hit2"}
  92. local sound = mySaber.Blade:FindFirstChild(SoundList[math.random(1,2)])
  93. sound.Pitch = math.random(90,110)/100
  94. sound:Play()
  95. AddEffect("Clash",mySaber.Blade,0.2)
  96. AddEffect("Sparks",theirSaber.Blade,0.75)
  97. AddEffect("ClashLight",theirSaber.Aura,0.4)
  98. if theirSaber:FindFirstChild("Blade2") then
  99. AddEffect("Sparks",theirSaber.Blade2,0.75)
  100. AddEffect("ClashLight",theirSaber.Aura2,0,4)
  101. end
  102. if theirSaber.Parent.Humanoid:FindFirstChild("Block") then
  103. theirSaber.Parent.Humanoid:FindFirstChild("Block"):Remove()
  104. local signal = Instance.new("ObjectValue")
  105. signal.Name = "ClashSignal"
  106. signal.Parent = theirSaber.Parent.Humanoid
  107. Stun()
  108. end
  109. end
  110. elseif p.Name == "Torso" and p.Parent:FindFirstChild("Humanoid") then
  111. candamage = false
  112. local hum = p.Parent:FindFirstChild("Humanoid")
  113. if not hum:FindFirstChild("Block") then
  114. hum:TakeDamage(20)
  115. local SoundList = {"hit1","hit2"}
  116. local sound = mySaber.Blade:FindFirstChild(SoundList[math.random(1,2)])
  117. sound.Pitch = math.random(90,110)/100
  118. sound:Play()
  119. elseif hum:FindFirstChild("Block") then
  120. hum:TakeDamage(0)
  121. end
  122. if not p.Parent:FindFirstChild(ls) then
  123. hum:TakeDamage(20)
  124. end
  125. end
  126.  
  127. end
  128. end
  129.  
  130. function Selected()
  131. enabled = true
  132. equip:Play(0.1,1,1.6)
  133. stamina = 200
  134. if not character:FindFirstChild(ls) then
  135. WeldParts(character["Right Arm"])
  136. end
  137. if character:FindFirstChild("HipSaber") then
  138. character:FindFirstChild("HipSaber"):Remove()
  139. end
  140. local saber = character:FindFirstChild(ls)
  141. saber.Handle.Equip:Play()
  142. saber.Aura.Glow.Color = tool.Glow.Value
  143. local c = saber.Emitter:GetChildren()
  144. for i = 1,#c do
  145. if c[i]:IsA("ParticleEmitter") then
  146. c[i].Color = ColorSequence.new(tool.Glow.Value,tool.Glow.Value)
  147. end
  148. end
  149. local c = saber.Aura:GetChildren()
  150. for i = 1,#c do
  151. if c[i]:IsA("ParticleEmitter") then
  152. c[i].Color = ColorSequence.new(tool.Glow.Value,tool.Glow.Value)
  153. end
  154.  
  155. character:FindFirstChild(ls).Blade.Touched:connect(OnTouch)end
  156. mouse.Button2Up:connect(Button2Up)
  157. end
  158.  
  159. function Deselected()
  160. if active == true then
  161. character[ls].Handle.sheathe:Play()
  162. end
  163. stamina = 200
  164. character.Humanoid.WalkSpeed = 16
  165. enabled = false
  166. active = false
  167. attacking = false
  168. canattack = false
  169. candamage = false
  170. blocking = false
  171. canblock = false
  172. blocking = false
  173. pose:Stop()
  174. block1:Stop()
  175. if character:FindFirstChild(ls) then
  176. character[ls]:Remove()
  177. end
  178. if character.Humanoid:FindFirstChild("Block") then
  179. character.Humanoid:FindFirstChild("Block"):Remove()
  180. end
  181. if not character:FindFirstChild("HipSaber") then
  182. local hilt = game.Lighting.LightSaberModel:Clone() -- Make sure the bloody saber is in lighting, or change from game.Lighting to whatever you want, JUST MAKE IT WORK...
  183. hilt.Parent = character
  184. hilt.Name = "HipSaber"
  185. local a = hilt.Handle
  186. local w = Instance.new("Weld")
  187. w.Name = "Weld"
  188. w.Parent = a
  189. w.Part0 = character["Torso"]
  190. w.Part1 = a
  191. w.C0 = CFrame.new(-0.8,-1,-0.6) * CFrame.fromEulerAnglesXYZ(math.rad(180),math.rad(180),math.rad(-5))
  192. end
  193. end
  194.  
  195. mouse.Button1Down:connect(function()
  196. local SwingSounds = {"slash","slash2"}
  197. if (enabled and active) and canattack and blocking == false and forceactive == false then
  198. local saber = character:FindFirstChild(ls)
  199. attacking = true
  200. canblock = false
  201. canattack = false
  202. local sound = saber.Blade:FindFirstChild(SwingSounds[math.random(1,2)])
  203. sound.Pitch = math.random(100,110)/100
  204. sound:Play()
  205. local function GetAnimation()
  206. local slashanims = {"Attack1","Attack2"}
  207. if hitcounter == 0 then
  208. timer = tick()
  209. hitcounter = 1
  210. return slashanims[1]
  211. elseif hitcounter == 1 then
  212. if (tick() - timer) > 1 then
  213. timer = tick()
  214. hitcounter = 1
  215. return slashanims[1]
  216. elseif (tick() - timer) < 1 then
  217. hitcounter = 0
  218. return slashanims[2]
  219. end
  220. end
  221. end
  222. local track = GetAnimation()
  223. local slash = character.Humanoid:LoadAnimation(tool[track])
  224. slash:Play(0.1,1,1.7)
  225. candamage = true
  226. saber.Blade.CanClash.Value = true
  227. character.Humanoid.WalkSpeed = 22
  228. wait(0.6)
  229. candamage = false
  230. character.Humanoid.WalkSpeed = 16
  231. wait(0.15)
  232. attacking = false
  233. canattack = true
  234. canblock = true
  235. end
  236. end)
  237.  
  238. mouse.Button2Down:connect(function()
  239. if (enabled and active and stamina > 0) and canblock == true and forceactive == false then
  240. blocking = true
  241. if not character.Humanoid:FindFirstChild("Block") then
  242. local blocker = Instance.new("ObjectValue")
  243. blocker.Name = "Block"
  244. blocker.Parent = character.Humanoid
  245. end
  246. attacking = false
  247. candamage = false
  248. canattack = false
  249. block1:Play()
  250. local saber = character:FindFirstChild(ls)
  251. saber.Blade.CanClash.Value = true
  252. local sound = saber.Blade:FindFirstChild("slash")
  253. sound.Pitch = math.random(95,110)/100
  254. sound:Play()
  255. Blocking()
  256. elseif (enabled and active and stamina > 0) and attacking and forceactive == false then
  257. blocking = true
  258. canblock = true
  259. if not character.Humanoid:FindFirstChild("Block") then
  260. local blocker = Instance.new("ObjectValue")
  261. blocker.Name = "Block"
  262. blocker.Parent = character.Humanoid
  263. end
  264. attacking = false
  265. canattack = false
  266. block1:Play()
  267. local saber = character:FindFirstChild(ls)
  268. saber.Blade.CanClash.Value = true
  269. local sound = saber.Blade:FindFirstChild("slash")
  270. sound.Pitch = math.random(95,110)/100
  271. sound:Play()
  272. Blocking()
  273. end
  274. end)
  275.  
  276. function Button2Up()
  277. if enabled and active and blocking and forceactive == false then
  278. if character.Humanoid:FindFirstChild("Block") then
  279. character.Humanoid:FindFirstChild("Block"):Remove()
  280. end
  281. block1:Stop()
  282. local saber = character:FindFirstChild(ls)
  283. saber.Blade.CanClash.Value = false
  284. local sound = saber.Blade:FindFirstChild("slash")
  285. sound.Pitch = math.random(95,110)/100
  286. sound:Play()
  287. wait()
  288. canattack = true
  289. canblock = true
  290. blocking = false
  291. coroutine.resume(coroutine.create(UpdateStamina))
  292. end
  293. end
  294.  
  295. function Stun()
  296. local saber = character:FindFirstChild(ls)
  297. pose:Stop()
  298. block1:Stop()
  299. stun:Play(0.5,1,1)
  300. character.Humanoid.WalkSpeed = 0
  301. character.Humanoid.JumpPower = 0
  302. if character.Humanoid:FindFirstChild("Block") then
  303. character.Humanoid:FindFirstChild("Block"):Remove()
  304. end
  305. enabled = false
  306. attacking = false
  307. canattack = false
  308. candamage = false
  309. blocking = false
  310. canblock = false
  311. blocking = false
  312. jumping = true
  313. wait(0.75)
  314. character.Humanoid.WalkSpeed = 16
  315. character.Humanoid.JumpPower = 50
  316. stun:Stop()
  317. pose:Play()
  318. jumping = false
  319. enabled = true
  320. canattack = true
  321. canblock = true
  322. end
  323.  
  324. function BladeUp()
  325. local saber = character:findFirstChild(ls)
  326. saber.Emitter.EmitterWeld.C0 = CFrame.new(0,0,0)
  327. local c = saber.Emitter:GetChildren()
  328. for i = 1,#c do
  329. if c[i]:IsA("ParticleEmitter") then
  330. c[i].Enabled = true
  331. end
  332. end
  333. saber.Aura.Transparency = 0.01
  334. local m = Instance.new("CylinderMesh")
  335. m.Parent = saber.Aura
  336. m.Scale = Vector3.new(1,0,1)
  337. m.Offset = Vector3.new(0,-2.05,0)
  338. local x = 15
  339. for i = 1,x do
  340. m.Scale = m.Scale + Vector3.new(0,1/x,0)
  341. m.Offset = m.Offset + Vector3.new(0,2.05/x)
  342. wait()
  343. end
  344. m:Destroy()
  345. local c = saber.Aura:GetChildren()
  346. for i = 1,#c do
  347. if c[i]:IsA("ParticleEmitter") then
  348. c[i].Transparency = NumberSequence.new(0.95)
  349. end
  350. end
  351. end
  352.  
  353. function BladeDown()
  354. local saber = character:findFirstChild(ls)
  355. saber.Emitter.EmitterWeld.C0 = CFrame.new(0,4.15,0)*CFrame.fromEulerAnglesXYZ(0,0,math.rad(180))
  356. wait(0.2)
  357. local m = Instance.new("CylinderMesh")
  358. m.Parent = saber.Aura
  359. m.Scale = Vector3.new(1,1,1)
  360. m.Offset = Vector3.new(0,0,0)
  361. local c = saber.Emitter:GetChildren()
  362. for i = 1,#c do
  363. if c[i]:IsA("ParticleEmitter") then
  364. c[i].Enabled = false
  365. end
  366. end
  367. local c = saber.Aura:GetChildren()
  368. for i = 1,#c do
  369. if c[i]:IsA("ParticleEmitter") then
  370. c[i].Transparency = NumberSequence.new(1)
  371. end
  372. end
  373. local x = 13
  374. for i = 1,x do
  375. m.Scale = m.Scale - Vector3.new(0,1/x,0)
  376. m.Offset = m.Offset - Vector3.new(0,2.05/x)
  377. wait()
  378. end
  379. m:Destroy()
  380. saber.Aura.Transparency = 1
  381. end
  382.  
  383. mouse.KeyDown:connect(function(key)
  384. --Toggling
  385. local saber = character:FindFirstChild(ls)
  386. if key == "q" and enabled then
  387. if active == false and activating == false and not blocking and not attacking then
  388. activating = true
  389. active = true
  390. pose:Play()
  391. wait(0.2)
  392. saber.Aura.Glow.Enabled = true
  393. saber.Handle.ignite:Play()
  394. saber.Handle.loop:Play()
  395. attacking = false
  396. canattack = true
  397. candamage = false
  398. blocking = false
  399. canblock = true
  400. BladeUp()
  401. activating = false
  402. elseif active == true and activating == false and not blocking and not attacking then
  403. activating = true
  404. active = false
  405. saber.Handle.sheathe:Play()
  406. BladeDown()
  407. saber.Aura.Glow.Enabled = false
  408. saber.Handle.loop:Pause()
  409. wait(0.2)
  410. pose:Stop()
  411. block1:Stop()
  412. activating = false
  413. attacking = false
  414. canattack = false
  415. candamage = false
  416. blocking = false
  417. canblock = false
  418. if character.Humanoid:FindFirstChild("Block") then
  419. character.Humanoid:FindFirstChild("Block"):Remove()
  420. end
  421. end
  422. --Flips
  423. elseif (key == "2"
  424. and jumping == false
  425. and blocking == false
  426. and direction ~= 0) then
  427. local function Flip()
  428. local flips = {469598245,0,469597912,0} -- This is how it works, you place the ID as wasd format, {w, a, s, d}
  429. local fliptrack = Instance.new("Animation")
  430. fliptrack.AnimationId = "http://www.roblox.com/Asset/?ID="..flips[direction]
  431. local flip = character.Humanoid:LoadAnimation(fliptrack)
  432. character.Humanoid.JumpPower = 65
  433. character.Humanoid.Jump = true
  434. character.Humanoid.WalkSpeed = 40
  435. stun:Stop()
  436. flip:Play(0.1,1,1.3)
  437. jumping = true
  438. canblock = false
  439. candamage = false
  440. attacking = false
  441. wait(0.4)
  442. character.Humanoid.WalkSpeed = 16
  443. character.Humanoid.JumpPower = 50
  444. canblock = true
  445. wait(0.7)
  446. jumping = false
  447. end
  448. if direction == 1 or direction == 3 then
  449. Flip()
  450. end
  451. elseif key == "w" then -- FORWARD
  452. direction = 1
  453. elseif key == "s" then -- BACKWARD
  454. direction = 3
  455. --Force
  456. elseif key == "f" and enabled and activating == false then
  457. if (attacking == false and blocking == false and stamina >= 170 and character.Torso:FindFirstChild("Left Shoulder"))
  458. and plr.Backpack:FindFirstChild("HasForce").Value == true then
  459. forceactive = true
  460. canblock = false
  461. canattack = false
  462. stamina = stamina - 170
  463. local pushtrack = Instance.new("Animation")
  464. pushtrack.AnimationId = "http://www.roblox.com/Asset/?ID=365857748"
  465. local push = character.Humanoid:LoadAnimation(pushtrack)
  466. push:Play()
  467. local p = Instance.new("Part")
  468. p.Parent = game.Workspace
  469. p.CanCollide = false
  470. p.formFactor = "Symmetric"
  471. p.Shape = "Block"
  472. p.Size = Vector3.new(1,1,1)
  473. p.Transparency = 1
  474. p.Material = "Neon"
  475. game.Debris:AddItem(p,1)
  476. local handlepos = character["Left Arm"].CFrame
  477. local firingPoint = handlepos.p + handlepos:vectorToWorldSpace(Vector3.new(0, 0.4, -1.3))
  478. local shotCFrame = CFrame.new(firingPoint, character.Humanoid.TargetPoint)
  479. p.CFrame = shotCFrame + (shotCFrame.lookVector * (p.Size.Z / 2))
  480. local bodyVelocity = Instance.new('BodyVelocity')
  481. bodyVelocity.velocity = shotCFrame.lookVector * 300
  482. bodyVelocity.Parent = p
  483. local victim = nil
  484. p.Touched:connect(function(p)
  485. if p.Parent ~= character and p.Parent:FindFirstChild("Humanoid") then
  486. victim = p.Parent
  487. local hum = p.Parent:FindFirstChild("Humanoid")
  488. hum.Sit = true
  489. local PushBack = CFrame.new(p.Position, character.Torso.Position).lookVector * -80
  490. PushBack = Vector3.new(PushBack.X, -80, PushBack.Z)
  491. p.Velocity = PushBack
  492. local signal = Instance.new("ObjectValue")
  493. signal.Name = "ClashSignal"
  494. signal.Parent = hum
  495. end
  496. end)
  497. wait(0.4)
  498. forceactive = false
  499. if active then
  500. canblock = true
  501. canattack = true
  502. end
  503. coroutine.resume(coroutine.create(UpdateStamina))
  504. end
  505. end
  506. end)
  507.  
  508. character.Humanoid.Running:connect(function(speed)
  509. if speed <= 0 then
  510. direction = 0
  511. end
  512. end)
  513.  
  514. character.Humanoid.ChildAdded:connect(function(item)
  515. if item.Name == "Block" then
  516. local saber = character:FindFirstChild(ls)
  517. saber.Blade.CanClash.Value = true
  518. blocking = true
  519. canblock = true
  520. Blocking()
  521. elseif item.Name == "ClashSignal" then
  522. stamina = 0
  523. coroutine.resume(coroutine.create(UpdateStamina))
  524. Button2Up()
  525. item:Destroy()
  526. end
  527. end)
  528.  
  529. function Blocking()
  530. while (blocking and canblock) and stamina > 0 do
  531. canattack = false
  532. candamage = false
  533. attacking = false
  534. stamina = stamina - 1
  535. coroutine.resume(coroutine.create(UpdateStamina))
  536. wait()
  537. end
  538. end
  539.  
  540. tool.Equipped:connect(Selected)
  541. tool.Unequipped:connect(Deselected)
Advertisement
Add Comment
Please, Sign In to add comment