Advertisement
Abejaron23

Untitled

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