SHARE
TWEET

Untitled

niko5927 Oct 19th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4.     print("FE Compatibility code by Mokiros")
  5.     script.Parent = Player.Character
  6.  
  7.     --RemoteEvent for communicating
  8.     local Event = Instance.new("RemoteEvent")
  9.     Event.Name = "UserInput_Event"
  10.  
  11.     --Fake event to make stuff like Mouse.KeyDown work
  12.     local function fakeEvent()
  13.         local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  14.         t.connect = t.Connect
  15.         return t
  16.     end
  17.  
  18.     --Creating fake input objects with fake variables
  19.     local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  20.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  21.     local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  22.         CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  23.     end}
  24.     --Merged 2 functions into one by checking amount of arguments
  25.     CAS.UnbindAction = CAS.BindAction
  26.  
  27.     --This function will trigger the events that have been :Connect()'ed
  28.     local function te(self,ev,...)
  29.         local t = m[ev]
  30.         if t and t._fakeEvent and t.Function then
  31.             t.Function(...)
  32.         end
  33.     end
  34.     m.TrigEvent = te
  35.     UIS.TrigEvent = te
  36.  
  37.     Event.OnServerEvent:Connect(function(plr,io)
  38.         if plr~=Player then return end
  39.         if io.isMouse then
  40.             m.Target = io.Target
  41.             m.Hit = io.Hit
  42.         else
  43.             local b = io.UserInputState == Enum.UserInputState.Begin
  44.             if io.UserInputType == Enum.UserInputType.MouseButton1 then
  45.                 return m:TrigEvent(b and "Button1Down" or "Button1Up")
  46.             end
  47.             for _,t in pairs(CAS.Actions) do
  48.                 for _,k in pairs(t.Keys) do
  49.                     if k==io.KeyCode then
  50.                         t.Function(t.Name,io.UserInputState,io)
  51.                     end
  52.                 end
  53.             end
  54.             m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  55.             UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  56.         end
  57.     end)
  58.     Event.Parent = NLS([==[
  59.     local Player = game:GetService("Players").LocalPlayer
  60.     local Event = script:WaitForChild("UserInput_Event")
  61.  
  62.     local UIS = game:GetService("UserInputService")
  63.     local input = function(io,a)
  64.         if a then return end
  65.         --Since InputObject is a client-side instance, we create and pass table instead
  66.         Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  67.     end
  68.     UIS.InputBegan:Connect(input)
  69.     UIS.InputEnded:Connect(input)
  70.  
  71.     local Mouse = Player:GetMouse()
  72.     local h,t
  73.     --Give the server mouse data 30 times every second, but only if the values changed
  74.     --If player is not moving their mouse, client won't fire events
  75.     while wait(1/30) do
  76.         if h~=Mouse.Hit or t~=Mouse.Target then
  77.             h,t=Mouse.Hit,Mouse.Target
  78.             Event:FireServer({isMouse=true,Target=t,Hit=h})
  79.         end
  80.     end]==],Player.Character)
  81.     Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  82. end
  83. local new=Instance.new
  84. local rad=math.rad
  85. local cf=CFrame.new
  86. local v3=Vector3.new
  87. local ang=function(x,y,z)
  88. return CFrame.Angles(rad(x),rad(y),rad(z))
  89. end
  90. local player=game:service'Players'.LocalPlayer
  91. local char=player.Character
  92. local cam=workspace.Camera
  93. local mouse=player:GetMouse()
  94. local weld=function(a,b,c0,c1)
  95. m=Instance.new('Motor',a)
  96. m.Part0=a
  97. m.Part1=b
  98. m.C0=c0
  99. m.C1=c1
  100. return m
  101. end
  102.  
  103. snd='rbxassetid://1683903796'
  104. beamm=Instance.new('Model',workspace)
  105. beamm.Name='beam'
  106.  
  107. laser=false
  108.  
  109. rs=Instance.new('Part',char)
  110. rs.Transparency=1
  111. rs.CanCollide=false
  112. rs.TopSurface,rs.BottomSurface=0,0
  113. rs.FormFactor=3
  114. rs.Size=Vector3.new(.5,.5,.5)
  115.  
  116. ls=rs:Clone()
  117. ls.Parent=char
  118.  
  119. rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf())
  120. lsw=weld(ls,char.Torso,cf(1,-.5,0),cf())
  121. raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8))
  122. law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43))
  123.  
  124. s1=Instance.new('Sound',char)
  125. s1.Volume=1
  126. s1.Pitch=1
  127. s1.Looped=true
  128. s1.SoundId=snd
  129.  
  130. particles={}
  131.  
  132. local wep=new('Part',char)
  133. wep.FormFactor=3
  134. wep.CanCollide=false
  135. wep.Size=v3(1,3,1)
  136. wep.TopSurface,wep.BottomSurface=0,0
  137. local wepw=weld(wep,char['Right Arm'],cf(.26,.4,.7),ang(0,0,8))
  138.  
  139. local beam=wep:Clone()
  140. beam:ClearAllChildren()
  141. beam.Material='Neon'
  142. beam.BrickColor=BrickColor.new('Toothpaste')
  143. beam.Size=Vector3.new(3,3,1)
  144. beam.Transparency=.5
  145. beam.Anchored=true
  146. local ms=Instance.new('BlockMesh',beam)
  147. local inner=beam:Clone()
  148. inner.Transparency=0
  149. inner.Material='SmoothPlastic'
  150. inner.BrickColor=BrickColor.new('Navy blue')
  151. local ms2=inner.Mesh
  152.  
  153. local expl=inner:Clone()
  154. expl.Mesh:Destroy()
  155. expl.Material='Neon'
  156. expl.BrickColor=BrickColor.new('Toothpaste')
  157. expl.Size=Vector3.new(11,11,11)
  158. expl.Transparency=.55
  159. pl=Instance.new('PointLight',expl)
  160. pl.Color=expl.BrickColor.Color
  161. pl.Range=pl.Range*2
  162. pl.Name='light'
  163. local br=pl.Range
  164.  
  165. local exa=expl:Clone()
  166. exa.Size=Vector3.new(4,4,4)
  167. pl2=exa.light
  168.  
  169. local part=exa:Clone()
  170. part.Size=Vector3.new(1.5,1.5,1.5)
  171. pl3=part.light
  172. pms=Instance.new('BlockMesh',part)
  173.  
  174. char.Humanoid.Died:connect(function()
  175. laser=false
  176. beam.Parent=nil
  177. inner.Parent=nil
  178. expl.Parent=nil
  179. exa.Parent=nil
  180. s1:stop()
  181. end)
  182.  
  183. mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then
  184. laser=true
  185. s1.Volume=1
  186. s1:play()
  187. end end)
  188. mouse.Button1Up:connect(function()
  189. laser=false
  190. beam.Parent=nil
  191. inner.Parent=nil
  192. expl.Parent=nil
  193. exa.Parent=nil
  194. s1:stop()
  195. end)
  196.  
  197. parti=0
  198. game:service'RunService'.Stepped:connect(function()
  199. parti=parti+1
  200. for i,v in pairs(particles) do
  201. v.CFrame=v.CFrame*CFrame.new(0,0,-.3)
  202. v.Transparency=v.Transparency+.08
  203. if v.Transparency >= 1 then
  204. v:Destroy()
  205. table.remove(particles,i)
  206. else
  207. v.Parent=beamm
  208. end
  209. end
  210. a=cam.CoordinateFrame.p
  211. b=mouse.Hit.p
  212. mhitr=Ray.new(a,(b-a).unit*999)
  213. mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm})
  214. raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8)
  215. law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43)
  216. if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then
  217. char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z))
  218. end
  219. if laser then
  220. beamm.Parent=workspace
  221. beam.Parent=beamm
  222. inner.Parent=beamm
  223. expl.Parent=beamm
  224. exa.Parent=beamm
  225. s1.Volume=s1.Volume-.002
  226.  
  227. 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*999)
  228. hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm})
  229.  
  230. if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then
  231. Instance.new('Explosion',workspace).Position=pos
  232. end
  233. if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then
  234. e=Instance.new('Explosion',workspace)
  235. e.Position=pos
  236. e.BlastRadius=14
  237. e.BlastPressure=1e4
  238. end
  239. if hit and not hit.Anchored and not (hit:GetMass()>1e4) then
  240. hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass())
  241. end
  242.  
  243. if parti==math.floor(parti) then
  244. par=part:Clone()
  245. table.insert(particles,par)
  246. par.Parent=beamm
  247. par.Transparency=1-s1.Volume
  248. par.light.Range=br*s1.Volume
  249. par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10)
  250. end
  251.  
  252. mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude
  253. ms.Scale=v3(s1.Volume,s1.Volume,mag)
  254. ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag))
  255. beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180))
  256. inner.CFrame=beam.CFrame
  257. pl.Range=br*s1.Volume
  258. pl2.Range=br*s1.Volume
  259. expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume
  260. expl.Transparency=math.random(40,60)/100
  261. expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  262. exa.Size=v3(4,4,4)*s1.Volume
  263. exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  264. char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume)
  265. end
  266. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top