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 & Mokiros")
- InternalData = {}
- do
- script.Parent = owner.Character
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput"
- local function NewFakeEvent()
- local Fake = {fakeEvent=true,Connect=function(self,Func)self.Function=Func 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.Function then
- Trigger.Function(...)
- end
- end
- Mouse.TrigEvent = TriggerEvent
- UserInputService.TrigEvent = TriggerEvent
- Event.OnServerEvent:Connect(function(FiredBy,Input)
- if FiredBy.Name ~= owner.Name then 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,Targer = 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
- else
- return RealPlayer[Index]
- end
- 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)
- if Service:lower() == "players" then
- 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
- })
- elseif Service:lower() == "contextactionservice" then
- return InternalData["ContextActionService"]
- elseif Service:lower() == "contextactionservice" then
- return InternalData["UserInputService"]
- elseif Service:lower() == "runservice" then
- 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() == "bindtorenderstep" then
- return function (self,Name,Priority,Function)
- return RealGame:GetService("RunService").Stepped:Connect(Function)
- end
- end
- if Index2:lower() == "renderstepped" then
- return RealService["Stepped"]
- end
- return RealService[Index2]
- end
- end
- })
- else
- return RealGame:GetService(Service)
- end
- 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
- else
- return nil
- end
- end
- });Game = game;owner = game:GetService("Players").LocalPlayer;script = {}
- print("Complete! Running...")
- local player = game:GetService("Players").LocalPlayer
- local character = player.Character
- local mouse = player:GetMouse()
- local introscreengui = Instance.new("ScreenGui")
- local introlabel = Instance.new("TextLabel")
- introscreengui.Parent = game.Players.LocalPlayer.PlayerGui
- introlabel.Parent = introscreengui
- introlabel.BackgroundTransparency = 1
- introlabel.Size = UDim2.new(0, 1270, 0, 707)
- introlabel.Position = UDim2.new(0, 15, 0, 25)
- introlabel.TextColor3 = Color3.new(130, 203, 255)
- introlabel.TextSize = 12
- introlabel.TextStrokeTransparency = (0)
- introlabel.Text = ("Press E to throw")
- local head = nil
- local headd = nil
- local headspeed = 2
- local headylock = 0
- local spinmode = 0
- function onKeyPress(inputObject, gameProcessedEvent)
- local key = inputObject.KeyCode
- if key == Enum.KeyCode.E and spinmode == 0 then
- spinmode = 1
- headylock = character.Head.Position.Y
- h = character.Head:Clone()
- character.Head.Transparency = 1
- character.Head.CanCollide = false
- character.Head.face.Transparency = 1
- h.Parent = character
- h.Name = ("FakeHead")
- h.Anchored = true
- h.CanCollide = false
- head = h
- for i,v in pairs(character:GetChildren()) do
- if v.ClassName == ("Accessory") then
- local a = v:Clone()
- a.Parent = h
- a.Handle.AccessoryWeld.Part0 = v.Handle
- a.Handle.AccessoryWeld.Part1 = h
- v.Handle.Transparency = 1
- end
- end
- h2 = Instance.new("Part")
- h2.Anchored = true
- h2.Size = Vector3.new(4,4,4)
- h2.CFrame = h.CFrame
- h2.Position = h2.Position + Vector3.new(0, -2, 0)
- h2.Transparency = 1
- h2.Parent = character
- h2.Name = ("FakeHeadDirection")
- h2.CanCollide = false
- headd = h2
- wait(0.5)
- headspeed = 2
- spinmode = -2
- headd.Anchored = false
- -- head.Anchored = false
- m = Instance.new("BodyPosition")
- m.Parent = headd
- m.Position = character.Head.Position
- m.MaxForce = Vector3.new(40000, 40000, 40000)
- m.P = 100
- wait(0.5)
- character.Head.Transparency = 0
- character.Head.face.Transparency = 0
- spinmode = 0
- head:Destroy()
- headd:Destroy()
- head = nil
- headd = nil
- character.Head.CanCollide = true
- for i,v in pairs(character:GetChildren()) do
- if v.ClassName == ("Accessory") then
- v.Handle.Transparency = 0
- end
- end
- end
- end
- game:GetService("UserInputService").InputBegan:connect(onKeyPress)
- while true do
- wait(0.01)
- if headd ~= nil then
- if spinmode == 1 then
- headd.CFrame = headd.CFrame + (headd.CFrame.lookVector * headspeed)
- head.Position = headd.Position
- head.Orientation = head.Orientation + Vector3.new(0, 90, 0)
- headspeed = headspeed - 0.04
- end
- if spinmode == 2 then
- headd.CFrame = headd.CFrame - (headd.CFrame.lookVector * headspeed)
- head.Position = headd.Position
- head.Orientation = head.Orientation + Vector3.new(0, -90, 0)
- headspeed = headspeed + 0.04
- end
- headd.Touched:connect(function(hit)
- if hit.Parent:FindFirstChild("HumanoidRootPart") ~= nil then
- if hit.Parent ~= character then
- print("Switch")
- for i,v in pairs(player.Character:GetChildren()) do
- if v.Name ~= ("q") then
- v.Parent = nil
- end
- end
- for i,v in pairs(hit.Parent:GetChildren()) do
- v.Parent = player.Character
- end
- game.Workspace.Camera.CameraSubject = player.Character.Humanoid
- end
- end
- if hit.Parent.Parent:FindFirstChild("HumanoidRootPart") ~= nil then
- if hit.Parent.Parent ~= character then
- print("Switch")
- for i,v in pairs(player.Character:GetChildren()) do
- if v.Name ~= ("q") then
- v.Parent = nil
- end
- end
- for i,v in pairs(hit.Parent.Parent:GetChildren()) do
- v.Parent = player.Character
- end
- game.Workspace.Camera.CameraSubject = player.Character.Humanoid
- end
- end
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement