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