Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by WaverlyCole");InternalData = {}
- do
- script.Parent = owner.Character
- local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
- local function NewFakeEvent()
- local Bind = Instance.new("BindableEvent")
- local Fake;Fake = {Connections = {},
- fakeEvent=true;
- Connect=function(self,Func)
- Bind.Event:connect(Func)
- self.Connections[Bind] = true
- return setmetatable({Connected = true},{
- __index = function (self,Index)
- if Index:lower() == "disconnect" then
- return function() Fake.Connections[Bind] = false;self.Connected = false end
- end
- return Fake[Index]
- end;
- __tostring = function() return "Connection" end;
- })
- end}
- Fake.connect = Fake.Connect;return Fake;
- end
- local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
- local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
- local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
- self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
- end};ContextActionService.UnBindAction = ContextActionService.BindAction
- local function TriggerEvent(self,Event,...)
- local Trigger = Mouse[Event]
- if Trigger and Trigger.fakeEvent and Trigger.Connections then
- for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
- end
- end
- Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
- Event.OnServerEvent:Connect(function(FiredBy,Input)
- if FiredBy.Name ~= owner.Name then return end
- if Input.MouseEvent then
- Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
- else
- local Begin = Input.UserInputState == Enum.UserInputState.Begin
- if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
- for _,Action in pairs(ContextActionService.Actions) do
- for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
- end
- Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
- UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
- end
- end)
- InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
- Event.Parent = NLS([[
- local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
- local Input = function(Input,gameProcessedEvent)
- if gameProcessedEvent then return end
- Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
- end
- UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
- local Hit,Target
- while wait(1/30) do
- if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
- Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
- end
- end
- ]],owner.Character)
- end
- RealGame = game;game = setmetatable({},{
- __index = function (self,Index)
- local Sandbox = function (Thing)
- if Thing:IsA("Player") then
- local RealPlayer = Thing
- return setmetatable({},{
- __index = function (self,Index)
- local Type = type(RealPlayer[Index])
- if Type == "function" then
- if Index:lower() == "getmouse" or Index:lower() == "mouse" then
- return function (self)return InternalData["Mouse"] end
- end
- return function (self,...)return RealPlayer[Index](RealPlayer,...) end
- end
- return RealPlayer[Index]
- end;
- __tostring = function(self) return RealPlayer.Name end
- })
- end
- end
- if RealGame[Index] then
- local Type = type(RealGame[Index])
- if Type == "function" then
- if Index:lower() == "getservice" or Index:lower() == "service" then
- return function (self,Service)
- local FakeServices = {
- ["players"] = function()
- return setmetatable({},{
- __index = function (self2,Index2)
- local RealService = RealGame:GetService(Service)
- local Type2 = type(Index2)
- if Type2 == "function" then
- return function (self,...) return RealService[Index2](RealService,...)end
- else
- if Index2:lower() == "localplayer" then return Sandbox(owner) end
- return RealService[Index2]
- end
- end;
- __tostring = function(self) return RealGame:GetService(Service).Name end
- })
- end;
- ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
- ["userinputservice"] = function() return InternalData["UserInputService"] end;
- ["runservice"] = function()
- return setmetatable({},{
- __index = function(self2,Index2)
- local RealService = RealGame:GetService(Service)
- local Type2 = type(Index2)
- if Type2 == "function" then
- return function (self,...) return RealService[Index2](RealService,...) end
- else
- local RunServices = {
- ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
- ["renderstepped"] = function() return RealService["Stepped"] end
- }
- if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
- return RealService[Index2]
- end
- end
- })
- end
- }
- if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
- return RealGame:GetService(Service)
- end
- end
- return function (self,...) return RealGame[Index](RealGame,...) end
- else
- if game:GetService(Index) then return game:GetService(Index) end
- return RealGame[Index]
- end
- end
- return nil
- end
- });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
- local next=next
- local crosshairimg="http://www.roblox.com/asset?id=20457765"
- game:service("ContentProvider"):Preload(crosshairimg)
- local ready=false
- local event
- local p=game.Players.LocalPlayer
- function run(pc)
- if event then event:disconnect() end
- wait(0.25)
- local tor=pc and pc:findFirstChild("Torso")
- local rs=tor and tor:findFirstChild("Right Shoulder")
- local ra=pc and pc:findFirstChild("Right Arm")
- local rac=ra:Clone()
- if rs then
- rs:Destroy()
- end
- local j=Instance.new("Weld",tor)
- j.Name="Aim"
- j.Part0=tor
- j.Part1=ra
- j.C0=CFrame.new(1.5,0.5,0)
- j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
- local s=Instance.new("HopperBin",p.Backpack)
- s.Name="Limb Launcher"
- local g=Instance.new("ScreenGui",p.PlayerGui)
- g.Name="Crosshair no target"
- local img1=Instance.new("ImageLabel",g)
- img1.Name="IMG"
- img1.Size=UDim2.new(0,210,0,210)
- img1.Position=UDim2.new(0,0,0,0)
- img1.BackgroundTransparency=1
- img1.Visible=false
- img1.Image=crosshairimg
- local ch=Instance.new("BillboardGui",p.PlayerGui)
- ch.Name="Crosshair on target"
- ch.Size=UDim2.new(0,210,0,210)
- ch.AlwaysOnTop=true
- ch.Enabled=false
- local img2=Instance.new("ImageLabel",ch)
- img2.Name="IMG"
- img2.Size=UDim2.new(1,0,1,0)
- img2.BackgroundTransparency=1
- img2.Image=crosshairimg
- local status=Instance.new("TextLabel",g)
- status.Name="Status"
- status.Size=UDim2.new(0,100,0,25)
- status.Position=UDim2.new(0,110,1,-85)
- status.Text=""
- status.FontSize=Enum.FontSize.Size14
- status.BackgroundColor=BrickColor.new("Really black")
- status.TextColor=BrickColor.new("Institutional white")
- status.BorderSizePixel=0
- local shot=false
- event=s.Selected:connect(function(m)
- local ccf
- local target
- local ftarg
- local hadtarget=false
- local unaim=false
- s.Parent=nil
- img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
- img1.Visible=true
- local aim=function()
- if not shot then
- target=nil
- local r=m.UnitRay
- local len=math.huge
- for _,o in next,workspace:GetChildren() do
- local fh=false
- for _,hum in next,o:GetChildren() do
- if hum.ClassName=="Humanoid" then
- fh=true
- break
- end
- end
- if o~=pc and fh then
- local h=o:findFirstChild("Head") or o:findFirstChild("Torso")
- if h and h.ClassName=="Part" then
- local cp=r:ClosestPoint(h.Position)
- local d=(h.Position-cp).magnitude/(cp-r.Origin).magnitude
- if d<=0.125 and d<=len then
- target=h
- len=d
- end
- end
- end
- end
- if target then
- local pos=tor.CFrame:pointToObjectSpace(target.Position)
- j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
- if target~=hadtarget then
- --print("Target acquired: ",target)
- hadtarget=target
- img1.Visible=false
- ch.Adornee=target
- ch.Enabled=true
- end
- status.Text="["..math.floor(pos.magnitude).."]"
- elseif not target then
- local pos=tor.CFrame:pointToObjectSpace((m.hit or tor.CFrame*CFrame.new(1.5,0.5,1)).p)
- j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
- img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
- if hadtarget then
- --print("Target lost")
- hadtarget=false
- ch.Enabled=false
- ch.Adornee=nil
- img1.Visible=true
- end
- status.Text=math.floor(pos.magnitude)
- end
- end
- end
- local ev1=m.Move:connect(function() unaim=aim() end)--move arm and check for nearby targets
- local ev2=m.Button1Down:connect(function()--shoot at target
- unaim=aim()--returns nothing, but makes the continuous aim skip so it doesn't use up CPU for nothing
- ccf=tor.CFrame*j.C0*(j.C1:inverse())
- ftarg=target
- shot=true
- end)
- repeat
- local ora=ra
- repeat--continuous aim
- if unaim then
- aim()
- else
- unaim=true
- end
- wait()
- until shot
- j:Destroy()
- local cccf=ccf
- local ltarg=ftarg
- local explode=false
- local v=Instance.new("BodyVelocity",ora)
- local b=Instance.new("BodyGyro",ora)
- b.maxTorque=Vector3.new(1e7,1e7,1e7)
- local function point(vel,cf)
- local x,y,z,xx,yx,zx,xy,yy,zy,xz,yz,zz=cf:components()
- v.velocity=-Vector3.new(yx,yy,yz)*vel
- b.cframe=cf
- end
- local v=0
- coroutine.resume(coroutine.create(function()
- local last=ora.Position
- repeat
- v=v+0.2
- if ltarg then
- local x,y,z,xx,yx,zx,xy,yy,zy,xz,yz,zz=CFrame.new(Vector3.new(0,0,0),ltarg.Position-ora.Position):components()
- point(v,CFrame.new(0,0,0, xx,zx,-yx, 0,zy,yy, xz,zz,-yz))
- else
- point(v,cccf)
- end
- last=ora.Position
- wait()
- until explode or not (ora and ora.Parent==workspace)
- local exp=Instance.new("Explosion",workspace)
- exp.Position=last
- exp.BlastRadius=v/6
- if ltarg then
- for _,ff in next,ltarg.Parent:GetChildren() do
- local fie=ff.ClassName=="ForceField" and ff or ff:findFirstChild("ForceField")
- if fie then
- fie:Destroy()
- end
- end
- end
- end))
- ora.Name = "Vroom Vroom going to hit yo face!"
- coroutine.resume(coroutine.create(function()
- local f=Instance.new("Fire",ora)
- f.Name="Fiar"
- f.Size=0.49
- wait(1)
- ora.Touched:connect(function(h)
- if (h==ltarg or not (ltarg and workspace:IsAncestorOf(ltarg))) and not (pc and pc.Parent==workspace and h:IsDescendantOf(pc)) and not (h:findFirstChild("Fiar") and h.Fiar.Size==0.49) and h.Name ~= "Vroom Vroom going to hit yo face!" then
- explode=true
- ora:Destroy()
- end
- end)
- end))
- ora.Parent=workspace
- ra=rac:Clone()
- ra.Parent=pc
- j=Instance.new("Weld",tor)
- j.Name="Aim"
- j.Part0=tor
- j.Part1=ra
- j.C0=CFrame.new(1.5,0.5,0)
- j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
- shot=false
- until not (pc and pc.Parent==workspace or not (p and p.Parent==game.Players)) and not (ra and ra:IsDescendantOf(workspace))
- ev1:disconnect()
- ev2:disconnect()
- end)
- end
- if p.Character then
- run(p.Character)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement