SHOW:
|
|
- or go back to the newest paste.
| 1 | ---------------------------------------- | |
| 2 | -- Originally made by Alfederate :D -- | |
| 3 | ---------------------------------------- | |
| 4 | ||
| 5 | -- there's no time to explain! -- | |
| 6 | -- This script has been converted to FE by iPxter | |
| 7 | ||
| 8 | ||
| 9 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 10 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
| 11 | do | |
| 12 | print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
| |
| 13 | script.Parent = Player.Character | |
| 14 | - | local player=game:service'Players'.LocalPlayer |
| 14 | + | |
| 15 | --RemoteEvent for communicating | |
| 16 | local Event = Instance.new("RemoteEvent")
| |
| 17 | - | local mouse=player:GetMouse() |
| 17 | + | Event.Name = "UserInput_Event" |
| 18 | ||
| 19 | --Fake event to make stuff like Mouse.KeyDown work | |
| 20 | local function fakeEvent() | |
| 21 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
| |
| 22 | t.connect = t.Connect | |
| 23 | return t | |
| 24 | end | |
| 25 | ||
| 26 | --Creating fake input objects with fake variables | |
| 27 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 28 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 29 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 30 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 31 | end} | |
| 32 | --Merged 2 functions into one by checking amount of arguments | |
| 33 | CAS.UnbindAction = CAS.BindAction | |
| 34 | ||
| 35 | --This function will trigger the events that have been :Connect()'ed | |
| 36 | local function te(self,ev,...) | |
| 37 | local t = m[ev] | |
| 38 | if t and t._fakeEvent and t.Function then | |
| 39 | t.Function(...) | |
| 40 | end | |
| 41 | end | |
| 42 | m.TrigEvent = te | |
| 43 | UIS.TrigEvent = te | |
| 44 | ||
| 45 | Event.OnServerEvent:Connect(function(plr,io) | |
| 46 | if plr~=Player then return end | |
| 47 | if io.isMouse then | |
| 48 | m.Target = io.Target | |
| 49 | m.Hit = io.Hit | |
| 50 | else | |
| 51 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 52 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 53 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 54 | end | |
| 55 | for _,t in pairs(CAS.Actions) do | |
| 56 | for _,k in pairs(t.Keys) do | |
| 57 | if k==io.KeyCode then | |
| 58 | t.Function(t.Name,io.UserInputState,io) | |
| 59 | end | |
| 60 | end | |
| 61 | end | |
| 62 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 63 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 64 | end | |
| 65 | end) | |
| 66 | Event.Parent = NLS([==[ | |
| 67 | local Player = game:GetService("Players").LocalPlayer
| |
| 68 | local Event = script:WaitForChild("UserInput_Event")
| |
| 69 | ||
| 70 | local UIS = game:GetService("UserInputService")
| |
| 71 | local input = function(io,a) | |
| 72 | if a then return end | |
| 73 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 74 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
| |
| 75 | end | |
| 76 | UIS.InputBegan:Connect(input) | |
| 77 | UIS.InputEnded:Connect(input) | |
| 78 | ||
| 79 | local Mouse = Player:GetMouse() | |
| 80 | local h,t | |
| 81 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 82 | --If player is not moving their mouse, client won't fire events | |
| 83 | while wait(1/30) do | |
| 84 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 85 | h,t=Mouse.Hit,Mouse.Target | |
| 86 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 87 | end | |
| 88 | end]==],Player.Character) | |
| 89 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
| 90 | end | |
| 91 | ||
| 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://229425359' | |
| 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.2 | |
| 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) |