Advertisement
xiaxiaokid

test thing

Nov 25th, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.46 KB | None | 0 0
  1. ----------------------------------------
  2. -- Originally made by Alfederate --
  3. ----------------------------------------
  4.  
  5. -- really just an improved version with camera shaking and shit so yeah, this was made by xiaxiaokid when he was bored --
  6. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  7. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  8. do
  9. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  10. script.Parent = Player.Character
  11.  
  12. --RemoteEvent for communicating
  13. local Event = Instance.new("RemoteEvent")
  14. Event.Name = "UserInput_Event"
  15.  
  16. --Fake event to make stuff like Mouse.KeyDown work
  17. local function fakeEvent()
  18. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  19. t.connect = t.Connect
  20. return t
  21. end
  22.  
  23. --Creating fake input objects with fake variables
  24. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  25. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  26. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  27. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  28. end}
  29. --Merged 2 functions into one by checking amount of arguments
  30. CAS.UnbindAction = CAS.BindAction
  31.  
  32. --This function will trigger the events that have been :Connect()'ed
  33. local function te(self,ev,...)
  34. local t = m[ev]
  35. if t and t._fakeEvent and t.Function then
  36. t.Function(...)
  37. end
  38. end
  39. m.TrigEvent = te
  40. UIS.TrigEvent = te
  41.  
  42. Event.OnServerEvent:Connect(function(plr,io)
  43. if plr~=Player then return end
  44. if io.isMouse then
  45. m.Target = io.Target
  46. m.Hit = io.Hit
  47. else
  48. local b = io.UserInputState == Enum.UserInputState.Begin
  49. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  50. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  51. end
  52. for _,t in pairs(CAS.Actions) do
  53. for _,k in pairs(t.Keys) do
  54. if k==io.KeyCode then
  55. t.Function(t.Name,io.UserInputState,io)
  56. end
  57. end
  58. end
  59. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  60. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  61. end
  62. end)
  63. Event.Parent = NLS([==[
  64. local Player = game:GetService("Players").LocalPlayer
  65. local Event = script:WaitForChild("UserInput_Event")
  66.  
  67. local UIS = game:GetService("UserInputService")
  68. local input = function(io,a)
  69. if a then return end
  70. --Since InputObject is a client-side instance, we create and pass table instead
  71. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  72. end
  73. UIS.InputBegan:Connect(input)
  74. UIS.InputEnded:Connect(input)
  75.  
  76. local Mouse = Player:GetMouse()
  77. local h,t
  78. --Give the server mouse data 30 times every second, but only if the values changed
  79. --If player is not moving their mouse, client won't fire events
  80. while wait(1/30) do
  81. if h~=Mouse.Hit or t~=Mouse.Target then
  82. h,t=Mouse.Hit,Mouse.Target
  83. Event:FireServer({isMouse=true,Target=t,Hit=h})
  84. end
  85. end]==],Player.Character)
  86. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  87. end
  88. wait(1/60)
  89. local new=Instance.new
  90. local rad=math.rad
  91. local cf=CFrame.new
  92. local v3=Vector3.new
  93. local ang=function(x,y,z)
  94. return CFrame.Angles(rad(x),rad(y),rad(z))
  95. end
  96. local Player = owner
  97. local Character = Player.Character
  98. local Humanoid = Character:FindFirstChildOfClass("Humanoid")
  99. local Torso = Character.Torso
  100. local cam=workspace.Camera
  101. local weld=function(a,b,c0,c1)
  102. m=Instance.new('Motor',a)
  103. m.Part0=a
  104. m.Part1=b
  105. m.C0=c0
  106. m.C1=c1
  107. return m
  108. end
  109. beamm=Instance.new('Model',workspace)
  110. beamm.Name='beam'
  111.  
  112. laser=false
  113. EffectModel = Instance.new("Model", Character)
  114. EffectModel.Name = "Effects"
  115. rs=Instance.new('Part',Character)
  116. rs.Transparency=1
  117. rs.CanCollide=false
  118. rs.TopSurface,rs.BottomSurface=0,0
  119. rs.FormFactor=3
  120. rs.Size=Vector3.new(.5,.5,.5)
  121.  
  122. ls=rs:Clone()
  123. ls.Parent=Character
  124.  
  125. rsw=weld(rs,Character.Torso,cf(-1,-.5,0),cf())
  126. lsw=weld(ls,Character.Torso,cf(1,-.5,0),cf())
  127. raw=weld(Character['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8))
  128. law=weld(Character['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43))
  129.  
  130.  
  131. particles={}
  132.  
  133. local wep=new('Part',Character)
  134. wep.FormFactor=3
  135. wep.CanCollide=false
  136. wep.Size=v3(1,3,1)
  137. wep.Transparency = 1
  138. wep.TopSurface,wep.BottomSurface=0,0
  139. local wepw=weld(wep,Character['Right Arm'],cf(.26,.4,.7),ang(0,0,8))
  140. local meshpartthing = new('Part',Character)
  141. meshpartthing.FormFactor=3
  142. meshpartthing.CanCollide=false
  143. meshpartthing.BrickColor = BrickColor.new("Really black")
  144. meshpartthing.Size=v3(1,1,1)
  145. meshpartthing.TopSurface,wep.BottomSurface=0,0
  146. local meshpartthingweld=weld(meshpartthing,Character['Right Arm'],cf(.26,-.4,.7),ang(-90,0,8))
  147. SpecialMesh1 = Instance.new("SpecialMesh")
  148. SpecialMesh1.Parent = meshpartthing
  149. SpecialMesh1.MeshId = "rbxassetid://1079186565"
  150. SpecialMesh1.Scale = Vector3.new(1.25, 1.25, 1.25)
  151. SpecialMesh1.MeshType = Enum.MeshType.FileMesh
  152. local beam=wep:Clone()
  153. beam:ClearAllChildren()
  154. beam.Material='Neon'
  155. beam.BrickColor=BrickColor.new('Toothpaste')
  156. beam.Size=Vector3.new(3,3,1)
  157. beam.Transparency=.5
  158. beam.Anchored=true
  159.  
  160. s1=Instance.new('Sound',beam)
  161. s1.Volume=2
  162. s1.Pitch=1
  163. s1.Looped=true
  164. s1.SoundId='rbxassetid://183339994'
  165. s2=Instance.new('Sound',wep)
  166. s2.Volume=2
  167. s2.Pitch=1
  168. s2.Looped=true
  169. s2.SoundId='rbxassetid://183339994'
  170. pew = Instance.new('Sound',wep)
  171. pew.Volume = 1
  172. pew.Pitch = 1.5
  173. pew.Looped = false
  174. pew.SoundId = 'rbxassetid://1796772196'
  175. asd = Instance.new('Sound',wep)
  176. asd.Volume = 1
  177. asd.Pitch = 1
  178. asd.Looped = false
  179. asd.SoundId = 'rbxassetid://342472444'
  180.  
  181. local ms=Instance.new('BlockMesh',beam)
  182. local inner=beam:Clone()
  183. inner.Transparency=0
  184. inner.Material='Neon'
  185. inner.BrickColor=BrickColor.new('Institutional white')
  186. local ms2=inner.Mesh
  187.  
  188. local expl=inner:Clone()
  189. expl.Mesh:Destroy()
  190. expl.Material='Neon'
  191. expl.BrickColor=BrickColor.new('Toothpaste')
  192. expl.Size=Vector3.new(11,11,11)
  193. expl.Transparency=.55
  194. pl=Instance.new('PointLight',expl)
  195. pl.Color=expl.BrickColor.Color
  196. pl.Range=pl.Range*2
  197. pl.Name='light'
  198. local br=pl.Range
  199.  
  200. CF = CFrame.new
  201. Mrandom = math.random
  202. cam = game.Workspace.CurrentCamera
  203. Rad = math.rad
  204. Euler = CFrame.fromEulerAnglesXYZ
  205. function CameraEnshaking(Length, Intensity)
  206. coroutine.resume(coroutine.create(function()
  207. local intensity = 1 * Intensity
  208. local rotM = 0.01 * Intensity
  209. for i = 0, Length, 0.1 do
  210. wait(1/120)
  211. intensity = intensity - 0.05 * Intensity / Length
  212. rotM = rotM - 5.0E-4 * Intensity / Length
  213. Humanoid.CameraOffset = Vector3.new(Rad(Mrandom(-intensity, intensity)), Rad(Mrandom(-intensity, intensity)), Rad(Mrandom(-intensity, intensity)))
  214. cam.CFrame = cam.CFrame * CF(Rad(Mrandom(-intensity, intensity)), Rad(Mrandom(-intensity, intensity)), Rad(Mrandom(-intensity, intensity))) * Euler(Rad(Mrandom(-intensity, intensity)) * rotM, Rad(Mrandom(-intensity, intensity)) * rotM, Rad(Mrandom(-intensity, intensity)) * rotM)
  215. end
  216. Humanoid.CameraOffset = Vector3.new(0, 0, 0)
  217. end))
  218. end
  219. local exa=expl:Clone()
  220. exa.Size=Vector3.new(4,4,4)
  221. pl2=exa.light
  222.  
  223. local part=exa:Clone()
  224. part.Size=Vector3.new(1.5,1.5,1.5)
  225. pl3=part.light
  226. pms=Instance.new('BlockMesh',part)
  227.  
  228.  
  229. Character.Humanoid.Died:connect(function()
  230. laser=false
  231. beam.Parent=nil
  232. inner.Parent=nil
  233. expl.Parent=nil
  234. exa.Parent=nil
  235. s1:Stop()
  236. s2:Stop()
  237. end)
  238.  
  239. mouse.Button1Down:connect(function()
  240. if Character.Humanoid.Health~=0 then
  241. laser=true
  242. s1.Volume=1.2
  243. s1:Play()
  244. s2.Volume=1.2
  245. s2:Play()
  246. pew:Play()
  247. end
  248. end)
  249. mouse.Button1Up:connect(function()
  250. laser=false
  251. beam.Parent=nil
  252. inner.Parent=nil
  253. expl.Parent=nil
  254. exa.Parent=nil
  255. s1:Stop()
  256. s2:Stop()
  257. asd:Play()
  258. end)
  259.  
  260. parti=0
  261. game:service'RunService'.Stepped:connect(function()
  262. parti=parti+1
  263. for i,v in pairs(particles) do
  264. v.CFrame=v.CFrame*CFrame.new(0,0,-.3)
  265. v.Transparency=v.Transparency+.08
  266. if v.Transparency >= 1 then
  267. v:Destroy()
  268. table.remove(particles,i)
  269. else
  270. v.Parent=beamm
  271. end
  272. end
  273. a=cam.CoordinateFrame.p
  274. b=mouse.Hit.p
  275. mhitr=Ray.new(a,(b-a).unit*9999)
  276. mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{Character,beamm})
  277. raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8)
  278. law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43)
  279. if not Character.Humanoid.Sit and not Character.Humanoid.PlatformStand then
  280. Character.Torso.CFrame=CFrame.new(Character.Torso.CFrame.p,Vector3.new(ps.x,Character.Torso.CFrame.p.y,ps.z))
  281. end
  282. if laser == true then
  283. beamm.Parent=workspace
  284. beam.Parent=beamm
  285. inner.Parent=beamm
  286. expl.Parent=beamm
  287. exa.Parent=beamm
  288. s1.Volume=s1.Volume-.002
  289. s2.Volume=s2.Volume-.002
  290. CameraEnshaking(0.5, 8*s1.Volume)
  291. ray=Ray.new((wep.CFrame*cf(0,-1.5,0)).p,((wep.CFrame*cf(0,-10,0)).p-(wep.CFrame*cf(0,-1.5,0)).p).unit*9999)
  292. hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{Character,beamm})
  293.  
  294. if hit and hit.Parent:findFirstChildOfClass('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then
  295. e=Instance.new('Explosion',workspace)
  296. e.Position=pos
  297. local boom = Instance.new('Sound',hit)
  298. boom.SoundId = "rbxassetid://262562442"
  299. boom.Volume = 8
  300. boom:play()
  301. if hit:FindFirstChild('Head') ~= nil then
  302. hit:BreakJoints()
  303. end
  304. end
  305. if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then
  306. e=Instance.new('Explosion',workspace)
  307. e.Position=pos
  308. e.Visible = false
  309. boom:play()
  310. e.BlastRadius=14
  311. e.BlastPressure=1e4
  312. end
  313. if hit and not hit.Anchored and not (hit:GetMass()>1e4) then
  314. hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass())
  315. end
  316.  
  317. if parti==math.floor(parti) then
  318. par=part:Clone()
  319. table.insert(particles,par)
  320. par.Parent=beamm
  321. par.Transparency=1-s1.Volume
  322. par.light.Range=br*s1.Volume
  323. par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10)
  324. end
  325.  
  326. mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude
  327. ms.Scale=v3(s1.Volume,s1.Volume,mag)
  328. ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag))
  329. beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180))
  330. inner.CFrame=beam.CFrame
  331. pl.Range=br*s1.Volume
  332. pl2.Range=br*s1.Volume
  333. expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume
  334. expl.Transparency=math.random(40,60)/100
  335. expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  336. exa.Size=v3(4,4,4)*s1.Volume
  337. exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  338. --Character.Torso.Velocity=Character.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume)
  339. end
  340. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement