HuyEvilDumb

eeeee

Jun 1st, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ----------------------------------------
  2.  -- Originally made by Alfederate :D --
  3. ----------------------------------------
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,game,owner = owner,game
  6. local RealPlayer = Player
  7. do
  8.     print("FE Compatibility code V2 by Mokiros")
  9.     local RealPlayer = RealPlayer
  10.     script.Parent = RealPlayer.Character
  11.  
  12.     --Fake event to make stuff like Mouse.KeyDown work
  13.     local Disconnect_Function = function(this)
  14.         this[1].Functions[this[2]] = nil
  15.     end
  16.     local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  17.     local FakeEvent_Metatable = {__index={
  18.         Connect = function(this,f)
  19.             local i = tostring(math.random(0,10000))
  20.             while this.Functions[i] do
  21.                 i = tostring(math.random(0,10000))
  22.             end
  23.             this.Functions[i] = f
  24.             return setmetatable({this,i},Disconnect_Metatable)
  25.         end
  26.     }}
  27.     FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  28.     local function fakeEvent()
  29.         return setmetatable({Functions={}},FakeEvent_Metatable)
  30.     end
  31.  
  32.     --Creating fake input objects with fake variables
  33.     local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  34.     FakeMouse.keyUp = FakeMouse.KeyUp
  35.     FakeMouse.keyDown = FakeMouse.KeyDown
  36.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  37.     local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  38.         CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  39.     end}
  40.     --Merged 2 functions into one by checking amount of arguments
  41.     CAS.UnbindAction = CAS.BindAction
  42.  
  43.     --This function will trigger the events that have been :Connect()'ed
  44.     local function TriggerEvent(self,ev,...)
  45.         for _,f in pairs(self[ev].Functions) do
  46.             f(...)
  47.         end
  48.     end
  49.     FakeMouse.TriggerEvent = TriggerEvent
  50.     UIS.TriggerEvent = TriggerEvent
  51.  
  52.     --Client communication
  53.     local Event = Instance.new("RemoteEvent")
  54.     Event.Name = "UserInput_Event"
  55.     Event.OnServerEvent:Connect(function(plr,io)
  56.         if plr~=RealPlayer then return end
  57.         FakeMouse.Target = io.Target
  58.         FakeMouse.Hit = io.Hit
  59.         if not io.isMouse then
  60.             local b = io.UserInputState == Enum.UserInputState.Begin
  61.             if io.UserInputType == Enum.UserInputType.MouseButton1 then
  62.                 return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  63.             end
  64.             if io.UserInputType == Enum.UserInputType.MouseButton2 then
  65.                 return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  66.             end
  67.             for _,t in pairs(CAS.Actions) do
  68.                 for _,k in pairs(t.Keys) do
  69.                     if k==io.KeyCode then
  70.                         t.Function(t.Name,io.UserInputState,io)
  71.                     end
  72.                 end
  73.             end
  74.             FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  75.             UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  76.         end
  77.     end)
  78.     Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  79.     local Mouse = owner:GetMouse()
  80.     local UIS = game:GetService("UserInputService")
  81.     local input = function(io,RobloxHandled)
  82.         if RobloxHandled then return end
  83.         --Since InputObject is a client-side instance, we create and pass table instead
  84.         Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  85.     end
  86.     UIS.InputBegan:Connect(input)
  87.     UIS.InputEnded:Connect(input)
  88.     local h,t
  89.     --Give the server mouse data every second frame, but only if the values changed
  90.     --If player is not moving their mouse, client won't fire events
  91.     local HB = game:GetService("RunService").Heartbeat
  92.     while true do
  93.         if h~=Mouse.Hit or t~=Mouse.Target then
  94.             h,t=Mouse.Hit,Mouse.Target
  95.             Event:FireServer({isMouse=true,Target=t,Hit=h})
  96.         end
  97.         --Wait 2 frames
  98.         for i=1,2 do
  99.             HB:Wait()
  100.         end
  101.     end]==],script)
  102.  
  103.     ----Sandboxed game object that allows the usage of client-side methods and services
  104.     --Real game object
  105.     local RealGame = game
  106.  
  107.     --Metatable for fake service
  108.     local FakeService_Metatable = {
  109.         __index = function(self,k)
  110.             local s = rawget(self,"_RealService")
  111.             if s then
  112.                 return typeof(s[k])=="function"
  113.                 and function(_,...)return s[k](s,...)end or s[k]
  114.             end
  115.         end,
  116.         __newindex = function(self,k,v)
  117.             local s = rawget(self,"_RealService")
  118.             if s then s[k]=v end
  119.         end
  120.     }
  121.     local function FakeService(t,RealService)
  122.         t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  123.         return setmetatable(t,FakeService_Metatable)
  124.     end
  125.  
  126.     --Fake game object
  127.     local FakeGame = {
  128.         GetService = function(self,s)
  129.             return rawget(self,s) or RealGame:GetService(s)
  130.         end,
  131.         Players = FakeService({
  132.             LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  133.         },"Players"),
  134.         UserInputService = FakeService(UIS,"UserInputService"),
  135.         ContextActionService = FakeService(CAS,"ContextActionService"),
  136.         RunService = FakeService({
  137.             _btrs = {},
  138.             RenderStepped = RealGame:GetService("RunService").Heartbeat,
  139.             BindToRenderStep = function(self,name,_,fun)
  140.                 self._btrs[name] = self.Heartbeat:Connect(fun)
  141.             end,
  142.             UnbindFromRenderStep = function(self,name)
  143.                 self._btrs[name]:Disconnect()
  144.             end,
  145.         },"RunService")
  146.     }
  147.     rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  148.     FakeGame.service = FakeGame.GetService
  149.     FakeService(FakeGame,game)
  150.     --Changing owner to fake player object to support owner:GetMouse()
  151.     game,owner = FakeGame,FakeGame.Players.LocalPlayer
  152. end
  153.  -- there's no time to explain! --
  154.  
  155. local new=Instance.new
  156. local rad=math.rad
  157. local cf=CFrame.new
  158. local v3=Vector3.new
  159. local ang=function(x,y,z)
  160. return CFrame.Angles(rad(x),rad(y),rad(z))
  161. end
  162. local player=game:service'Players'.LocalPlayer
  163. local char=player.Character
  164. local cam=workspace.Camera
  165. local mouse=player:GetMouse()
  166. local weld=function(a,b,c0,c1)
  167. m=Instance.new('Motor',a)
  168. m.Part0=a
  169. m.Part1=b
  170. m.C0=c0
  171. m.C1=c1
  172. return m
  173. end
  174.  
  175. start='rbxassetid://592555095'
  176. snd='rbxassetid://594472043'
  177. beamm=Instance.new('Model',workspace)
  178. beamm.Name='beam'
  179.  
  180. laser=false
  181.  
  182. rs=Instance.new('Part',char)
  183. rs.Transparency=1
  184. rs.CanCollide=false
  185. rs.TopSurface,rs.BottomSurface=0,0
  186. rs.FormFactor=3
  187. rs.Size=Vector3.new(.5,.5,.5)
  188.  
  189. ls=rs:Clone()
  190. ls.Parent=char
  191.  
  192. rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf())
  193. lsw=weld(ls,char.Torso,cf(1,-.5,0),cf())
  194. raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8))
  195. law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43))
  196.  
  197. vol=1
  198.  
  199. s1=Instance.new('Sound',char)
  200. s1.Volume=vol
  201. s1.Pitch=1
  202. s1.Looped=true
  203. s1.SoundId=snd
  204.  
  205. s2=Instance.new('Sound',char)
  206. s2.Volume=vol
  207. s2.Pitch=1
  208. s2.Looped=true
  209. s2.SoundId=start
  210.  
  211. s2:play()
  212.  
  213. particles={}
  214.  
  215. local wep=new('Part',char)
  216. wep.FormFactor=3
  217. wep.CanCollide=false
  218. wep.Size=v3(1,3,1)
  219. wep.TopSurface,wep.BottomSurface=0,0
  220. local wepw=weld(wep,char['Right Arm'],cf(.26,.4,.7),ang(0,0,8))
  221.  
  222. local beam=wep:Clone()
  223. beam:ClearAllChildren()
  224. beam.Material='Neon'
  225. beam.BrickColor=BrickColor.new('Electric blue')
  226. beam.Size=Vector3.new(3,3,1)
  227. beam.Transparency=.5
  228. beam.Anchored=true
  229. local ms=Instance.new('BlockMesh',beam)
  230. local inner=beam:Clone()
  231. inner.Transparency=0
  232. inner.Material='SmoothPlastic'
  233. inner.BrickColor=BrickColor.new('Green')
  234. local ms2=inner.Mesh
  235.  
  236. local expl=inner:Clone()
  237. expl.Mesh:Destroy()
  238. expl.Material='Neon'
  239. expl.BrickColor=BrickColor.new('Really red')
  240. expl.Size=Vector3.new(11,11,11)
  241. expl.Transparency=.55
  242. pl=Instance.new('PointLight',expl)
  243. pl.Color=expl.BrickColor.Color
  244. pl.Range=pl.Range*2
  245. pl.Name='light'
  246. local br=pl.Range
  247.  
  248. local exa=expl:Clone()
  249. exa.Size=Vector3.new(4,4,4)
  250. pl2=exa.light
  251.  
  252. local part=exa:Clone()
  253. part.Size=Vector3.new(1.5,1.5,1.5)
  254. pl3=part.light
  255. pms=Instance.new('BlockMesh',part)
  256.  
  257. char.Humanoid.Died:connect(function()
  258. laser=false
  259. beam.Parent=nil
  260. inner.Parent=nil
  261. expl.Parent=nil
  262. exa.Parent=nil
  263. s2:stop()
  264. s1:stop()
  265. end)
  266.  
  267. mouse.Button1Down:connect(function() if char.Humanoid.Health~=0 then
  268. laser=true
  269. s1:play()
  270. s2:stop()
  271. end end)
  272. mouse.Button1Up:connect(function()
  273. laser=false
  274. beam.Parent=nil
  275. inner.Parent=nil
  276. expl.Parent=nil
  277. exa.Parent=nil
  278. s1:stop()
  279. s2:play()
  280. end)
  281.  
  282. parti=0
  283. game:service'RunService'.Stepped:connect(function()
  284. parti=parti+1
  285. for i,v in pairs(particles) do
  286. v.CFrame=v.CFrame*CFrame.new(0,0,-.3)
  287. v.Transparency=v.Transparency+.08
  288. if v.Transparency >= 1 then
  289. v:Destroy()
  290. table.remove(particles,i)
  291. else
  292. v.Parent=beamm
  293. end
  294. end
  295. a=cam.CoordinateFrame.p
  296. b=mouse.Hit.p
  297. mhitr=Ray.new(a,(b-a).unit*999)
  298. mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm})
  299. raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8)
  300. law.C1=ang(90+(mouse.Hit.lookVector.y*90),0,43)
  301. if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then
  302. char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z))
  303. end
  304. if laser then
  305. beamm.Parent=workspace
  306. beam.Parent=beamm
  307. inner.Parent=beamm
  308. expl.Parent=beamm
  309. exa.Parent=beamm
  310. s1.Volume=s1.Volume-.0
  311.  
  312. 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)
  313. hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm})
  314.  
  315. if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then
  316. Instance.new('Explosion',workspace).Position=pos
  317. end
  318. if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then
  319. e=Instance.new('Explosion',workspace)
  320. e.Position=pos
  321. e.BlastRadius=14
  322. e.BlastPressure=1e4
  323. end
  324. if hit and not hit.Anchored and not (hit:GetMass()>1e4) then
  325. hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass())
  326. end
  327.  
  328. if parti==math.floor(parti) then
  329. par=part:Clone()
  330. table.insert(particles,par)
  331. par.Parent=beamm
  332. par.Transparency=1-s1.Volume
  333. par.light.Range=br*s1.Volume
  334. par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10)
  335. end
  336.  
  337. mag=((wep.CFrame*cf(0,-1.5,0)).p-pos).magnitude
  338. ms.Scale=v3(s1.Volume,s1.Volume,mag)
  339. ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag))
  340. beam.CFrame=cf((wep.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180))
  341. inner.CFrame=beam.CFrame
  342. pl.Range=br*s1.Volume
  343. pl2.Range=br*s1.Volume
  344. expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume
  345. expl.Transparency=math.random(40,60)/100
  346. expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  347. exa.Size=v3(4,4,4)*s1.Volume
  348. exa.CFrame=wep.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  349. char.Torso.Velocity=char.Torso.Velocity-beam.CFrame.lookVector*(7*s1.Volume)
  350. end
  351. end)
Advertisement
Add Comment
Please, Sign In to add comment