Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- local player = game.Players.LocalPlayer
- local powerlevel = 3
- --[[if player:GetRankInGroup(1164009) == 1 or player:IsInGroup(1164002) then -- Group rankings for power levels.
- powerlevel = 2
- end
- if player:GetRankInGroup(1156932) == 15 or player.userId == 18422431 then
- powerlevel = 3
- end
- if player:GetRankInGroup(1156932) >= 16 then
- powerlevel = 4
- end
- if player.userId == -1 then
- powerlevel = 3
- end]]
- repeat wait(0.01) until player.Character
- local character = player.Character
- local b1d = false
- local target = nil
- local nbpos = Instance.new("BodyPosition")
- nbpos.maxForce = Vector3.new(999999999,999999999,999999999)
- local bpos = nil
- local dist = 0
- local ldebounce = false
- local factor = 1
- local keys = {}
- local LightningBin = nil
- local choked = false
- function LPart()
- local np = Instance.new("Part")
- np.Transparency = 1
- np.CanCollide = false
- np.Anchored = true
- np.FormFactor = Enum.FormFactor.Custom
- local ntex = Instance.new("Texture",np)
- ntex.Shiny = 20
- ntex.Specular = 1
- ntex.StudsPerTileU = 27
- ntex.StudsPerTileV = 6
- ntex.Texture = 'rbxassetid://171316532'
- ntex.Transparency = 0.1
- ntex.Face = "Left"
- local ntex2 = Instance.new("Texture",np)
- ntex2.Shiny = 20
- ntex2.Specular = 1
- ntex2.StudsPerTileU = 27
- ntex2.StudsPerTileV = 6
- ntex2.Texture = 'rbxassetid://171316532'
- ntex2.Transparency = 0.1
- ntex2.Face = "Right"
- return np
- end
- function Start()
- if target then
- local startp = target.CFrame.p
- if not bpos then
- bpos = nbpos:clone()
- bpos.Parent = script.Parent
- end
- if not character:findFirstChild("Torso") then
- return
- end
- if nrw and nlw then
- nrw:remove()
- nlw:remove()
- end
- game.Players.LocalPlayer.Character.Torso["Right Shoulder"].Part1 = nil
- game.Players.LocalPlayer.Character.Torso["Left Shoulder"].Part1 = nil
- nrw = Instance.new("ManualWeld",game.Players.LocalPlayer.Character.Torso)
- nrw.Part0 = game.Players.LocalPlayer.Character.Torso
- nrw.Part1 = game.Players.LocalPlayer.Character["Right Arm"]
- nrw.C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0
- nrw.C1 = CFrame.new(-.5,.5,0)*CFrame.Angles(0,math.rad(90),math.rad(-90))
- nlw = Instance.new("ManualWeld",game.Players.LocalPlayer.Character.Torso)
- nlw.Part0 = game.Players.LocalPlayer.Character.Torso
- nlw.Part1 = game.Players.LocalPlayer.Character["Left Arm"]
- nlw.C0 = game.Players.LocalPlayer.Character.Torso["Left Shoulder"].C0
- nlw.C1 = CFrame.new(.5,.5,0)*CFrame.Angles(0,math.rad(-90),math.rad(90))
- dist = (character.Torso.CFrame.p - target.CFrame.p).magnitude
- bpos.position = character:findFirstChild("Torso").CFrame.p + player:GetMouse().Hit.lookVector*dist
- bpos.Parent = target
- local looped = 0
- repeat
- if not choking then
- looped = looped+1/30
- if looped >= 5 and target then
- if target.Parent:findFirstChild("Humanoid") then
- b1d = false
- end
- end
- wait(1/30)
- if not character:findFirstChild("Torso") then
- return
- end
- if not bpos then
- bpos = nbpos:clone()
- bpos.Parent = script.Parent
- end
- bpos.position = character:findFirstChild("Torso").CFrame.p + player:GetMouse().Hit.lookVector*dist
- end
- until b1d == false
- target = nil
- end
- if bpos then
- bpos.Parent = script.Parent
- end
- local ya = false
- for n,i in pairs(keys) do
- if i then
- ya = true
- end
- end
- if b1d then ya = true end
- if not ya and nrw and nlw then
- nrw:remove()
- nlw:remove()
- game.Players.LocalPlayer.Character.Torso["Right Shoulder"].Part1 = game.Players.LocalPlayer.Character["Right Arm"]
- game.Players.LocalPlayer.Character.Torso["Left Shoulder"].Part1 = game.Players.LocalPlayer.Character["Left Arm"]
- end
- end
- function Fire()
- if ldebounce then
- return
- end
- ldebounce = true
- if not game.Players.LocalPlayer.Character then
- ldebounce = false
- return
- end
- repeat
- if nrw and nlw then nrw:remove() nlw:remove() end
- if not LightningBin then
- LightningBin = Instance.new("Model",workspace)
- LightningBin.Name = game.Players.LocalPlayer.Name.."'s Lightning Bin"
- end
- local hit = player:GetMouse().Hit
- if target then
- hit = target.CFrame
- end
- hit = CFrame.new(game.Players.LocalPlayer.Character.Torso.CFrame.p,hit.p)*CFrame.new(0,0,-100)
- local ray = Ray.new(game.Players.LocalPlayer.Character.Torso.CFrame.p,hit.lookVector*(100))
- local phit,hit = workspace:findPartOnRay(ray,game.Players.LocalPlayer.Character)
- if phit and phit.Parent and phit.Parent:findFirstChild("Humanoid") then
- phit.Parent:findFirstChild("Humanoid"):TakeDamage(3)
- end
- game.Players.LocalPlayer.Character.Torso["Right Shoulder"].Part1 = nil
- game.Players.LocalPlayer.Character.Torso["Left Shoulder"].Part1 = nil
- nrw = Instance.new("ManualWeld",game.Players.LocalPlayer.Character.Torso)
- nrw.Part0 = game.Players.LocalPlayer.Character.Torso
- nrw.Part1 = game.Players.LocalPlayer.Character["Right Arm"]
- nrw.C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0
- nrw.C1 = CFrame.new(-.5,.5,0)*CFrame.Angles(0,math.rad(90),math.rad(-90))
- nlw = Instance.new("ManualWeld",game.Players.LocalPlayer.Character.Torso)
- nlw.Part0 = game.Players.LocalPlayer.Character.Torso
- nlw.Part1 = game.Players.LocalPlayer.Character["Left Arm"]
- nlw.C0 = game.Players.LocalPlayer.Character.Torso["Left Shoulder"].C0
- nlw.C1 = CFrame.new(.5,.5,0)*CFrame.Angles(0,math.rad(-90),math.rad(90))
- local racf = game.Players.LocalPlayer.Character["Right Arm"].CFrame*CFrame.new(0,-1,0)
- local lacf = game.Players.LocalPlayer.Character["Left Arm"].CFrame*CFrame.new(0,-1,0)
- for i = 1,2 do
- local rand = math.random(2)
- local rand2 = math.random(2)
- local np = LPart()
- np.Size = Vector3.new(0.2,6,(hit-racf.p).magnitude)
- local rhit = CFrame.new(hit,racf.p)*CFrame.new(-1.5,0,0)
- rhit = rhit.p
- np.CFrame = CFrame.new(rhit,racf.p)*CFrame.new(0,0,-(rhit-racf.p).magnitude/2)*CFrame.Angles(math.rad(180*rand2),math.rad(180*rand),math.rad(90*i))
- np.Parent = LightningBin
- for i2 = 1, math.random(1,2) do
- local dist = (rhit-racf.p).magnitude
- local nnpos = CFrame.new(rhit,racf.p)*CFrame.new(0,0,-(rhit-racf.p).magnitude/(math.random(13,20)/10))
- local roll1 = math.random(-5,5)
- local roll2 = math.random(-5,5)
- local roll3 = math.random(-45,45)
- local roll4 = math.random(-3-dist/30,3+dist/30)
- local roll5 = math.random(-3-dist/30,3+dist/30)
- local nnp = LPart()
- nnp.Size = Vector3.new(0.2,6,(rhit-nnpos.p).magnitude/(math.random(25,40)/10))
- nnp.CFrame = nnpos*CFrame.Angles(math.rad(roll1),math.rad(roll2),math.rad(roll3))*CFrame.new(0,0,nnp.Size.Z/2)
- local nnpc = nnp:clone()
- nnpc.CFrame = nnp.CFrame*CFrame.Angles(math.rad(180*rand2),math.rad(180*rand),math.rad(90*i))
- local nnp2 = LPart()
- local nnp2origin = nnp.CFrame*CFrame.new(0,0,nnp.Size.Z/2)
- nnp2.Size = Vector3.new(0.2,6,(rhit-nnp2origin.p).magnitude)
- local nhit = CFrame.new(rhit,racf.p)*CFrame.new(roll4,roll5,0)
- nnp2.CFrame = CFrame.new(nnp2origin.p,nhit.p)*CFrame.new(0,0,-nnp2.Size.Z/2)
- local nnp2c = nnp2:clone()
- nnp2c.CFrame = nnp2.CFrame*CFrame.Angles(math.rad(180*rand2),math.rad(180*rand),math.rad(90*i))
- nnp.Parent = LightningBin
- nnp2.Parent = LightningBin
- nnpc.Parent = LightningBin
- nnp2c.Parent = LightningBin
- end
- local np2 = LPart()
- local rand21 = math.random(2)
- local rand22 = math.random(2)
- local lhit = CFrame.new(hit,lacf.p)*CFrame.new(1.5,0,0)
- lhit = lhit.p
- np2.Size = Vector3.new(0.2,6,(lhit-lacf.p).magnitude)
- np2.CFrame = CFrame.new(lhit,lacf.p)*CFrame.new(0,0,-(lhit-lacf.p).magnitude/2)*CFrame.Angles(math.rad(180*rand22),math.rad(180*rand21),math.rad(90*i))
- np2.Parent = LightningBin
- for i2 = 1, math.random(1,2) do
- local dist = (lhit-racf.p).magnitude
- local nnpos = CFrame.new(lhit,lacf.p)*CFrame.new(0,0,-(lhit-lacf.p).magnitude/(math.random(13,20)/10))
- local roll1 = math.random(-5,5)
- local roll2 = math.random(-5,5)
- local roll3 = math.random(-45,45)
- local roll4 = math.random(-3-dist/30,3+dist/30)
- local roll5 = math.random(-3-dist/30,3+dist/30)
- local nnp = LPart()
- nnp.Size = Vector3.new(0.2,6,(lhit-nnpos.p).magnitude/(math.random(25,40)/10))
- nnp.CFrame = nnpos*CFrame.Angles(math.rad(roll1),math.rad(roll2),math.rad(roll3))*CFrame.new(0,0,nnp.Size.Z/2)
- local nnpc = nnp:clone()
- nnpc.CFrame = nnp.CFrame*CFrame.Angles(math.rad(180*rand2),math.rad(180*rand),math.rad(90*i))
- local nnp2 = LPart()
- local nnp2origin = nnp.CFrame*CFrame.new(0,0,nnp.Size.Z/2)
- nnp2.Size = Vector3.new(0.2,6,(lhit-nnp2origin.p).magnitude)
- local nhit = CFrame.new(lhit,lacf.p)*CFrame.new(roll4,roll5,0)
- nnp2.CFrame = CFrame.new(nnp2origin.p,nhit.p)*CFrame.new(0,0,-nnp2.Size.Z/2)
- local nnp2c = nnp2:clone()
- nnp2c.CFrame = nnp2.CFrame*CFrame.Angles(math.rad(180*rand2),math.rad(180*rand),math.rad(90*i))
- nnp.Parent = LightningBin
- nnp2.Parent = LightningBin
- nnpc.Parent = LightningBin
- nnp2c.Parent = LightningBin
- end
- end
- wait(1/10)
- for n,i in pairs(LightningBin:GetChildren()) do
- i:remove()
- end
- until not keys["f"]
- ldebounce = false
- local ya = false
- for n,i in pairs(keys) do
- if i then
- ya = true
- end
- end
- if b1d then ya = true end
- if not ya and nrw and nlw then
- nrw:remove()
- nlw:remove()
- game.Players.LocalPlayer.Character.Torso["Right Shoulder"].Part1 = game.Players.LocalPlayer.Character["Right Arm"]
- game.Players.LocalPlayer.Character.Torso["Left Shoulder"].Part1 = game.Players.LocalPlayer.Character["Left Arm"]
- end
- end
- function Choke()
- if target.Parent:findFirstChild("Humanoid") and target.Parent:findFirstChild("Right Arm") and target.Parent:findFirstChild("Left Arm") and target.Parent:findFirstChild("Torso") then
- local targ = target.Parent
- targ.Torso["Right Shoulder"].Part1 = nil
- targ.Torso["Left Shoulder"].Part1 = nil
- local nrw2 = Instance.new("ManualWeld",targ.Torso)
- nrw2.Part0 = targ.Torso
- nrw2.Part1 = targ["Right Arm"]
- nrw2.C0 = targ.Torso["Right Shoulder"].C0
- nrw2.C1 = CFrame.new(0.1,0.5,0.5)*CFrame.Angles(0,math.rad(90),0)*CFrame.Angles(math.rad(-110),0,0)*CFrame.Angles(0,0,math.rad(30))
- local nlw2 = Instance.new("ManualWeld",targ.Torso)
- nlw2.Part0 = targ.Torso
- nlw2.Part1 = targ["Left Arm"]
- nlw2.C0 = targ.Torso["Left Shoulder"].C0
- nlw2.C1 = CFrame.new(-.10,0.5,0.5)*CFrame.Angles(0,math.rad(-90),0)*CFrame.Angles(math.rad(-110),0,0)*CFrame.Angles(0,0,math.rad(-30))
- local looped = 0
- local choking = true
- repeat
- looped = looped+1/30
- wait(1/30)
- targ:findFirstChild("Humanoid"):TakeDamage(.5)
- until (not keys["r"] or
- not b1d or
- not targ:findFirstChild("Humanoid") or
- targ.Humanoid.Health <= 0 or
- looped > 3)
- keys["r"] = false
- local choking = false
- if nrw2 and nlw2 then
- nrw2:remove()
- nlw2:remove()
- end
- targ.Torso["Right Shoulder"].Part1 = targ["Right Arm"]
- targ.Torso["Left Shoulder"].Part1 = targ["Left Arm"]
- end
- end
- player:GetMouse().Button1Down:connect(function()
- if script.Parent.Active then
- choked = false
- target = player:GetMouse().Target
- if target then
- if not character:findFirstChild("Torso") then return end
- if (target.CFrame.p - character.Torso.CFrame.p).magnitude > 10 and powerlevel == 1 then return end
- if (target.CFrame.p - character.Torso.CFrame.p).magnitude > 100 and (powerlevel == 2 or powerlevel == 3) then return end
- if (target.CFrame.p - character.Torso.CFrame.p).magnitude > 1000 and powerlevel == 4 then return end
- end
- b1d = true
- if target then
- target = target:GetRootPart()
- end
- Start()
- end
- end)
- player:GetMouse().KeyDown:connect(function(k)
- if k == "q" then
- keys["q"] = true
- repeat
- if choking then return end
- if dist > 15 and powerlevel == 1 then break end
- if dist > 150 and (powerlevel == 2 or powerlevel == 3) then break end
- if dist > 1500 and powerlevel == 4 then break end
- wait(1/30)
- dist = dist+factor
- until not keys["q"]
- elseif k == "e" then
- keys["e"] = true
- repeat
- if choking then return end
- if dist < 3 then break end
- wait(1/30)
- dist = dist-factor
- until not keys["e"]
- elseif k == "4" and powerlevel >= 2 then
- factor = 10
- if choking then return end
- elseif k == "f" and powerlevel >= 3 then
- keys["f"] = true
- if choking then return end
- Fire(false)
- elseif k == "r" and powerlevel >= 2 and target and b1d then
- keys["r"] = true
- choked = true
- Choke()
- end
- end)
- player:GetMouse().KeyUp:connect(function(k)
- if k == "4" then
- factor = 1
- elseif k == "q" then
- keys["q"] = false
- elseif k == "e" then
- keys["e"] = false
- elseif k == "f" then
- keys["f"] = false
- elseif k == "r" then
- keys["r"] = false
- end
- end)
- player:GetMouse().Button1Up:connect(function()
- b1d = false
- end)
- script.Parent.Selected:connect(function()
- LightningBin = Instance.new("Model",workspace)
- LightningBin.Name = game.Players.LocalPlayer.Name.."'s Lightning Bin"
- end)
- script.Parent.Deselected:connect(function()
- b1d = false
- down = false
- if LightningBin then
- LightningBin:remove()
- end
- end)
- character.Humanoid.Died:connect(function()
- b1d = false
- down = false
- if LightningBin then
- LightningBin:remove()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement