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
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Motor6D2 = Instance.new("Motor6D")
- Part3 = Instance.new("Part")
- Motor6D4 = Instance.new("Motor6D")
- Motor6D5 = Instance.new("Motor6D")
- Motor6D6 = Instance.new("Motor6D")
- Motor6D7 = Instance.new("Motor6D")
- Part8 = Instance.new("Part")
- Part9 = Instance.new("Part")
- Part10 = Instance.new("Part")
- Part11 = Instance.new("Part")
- Part12 = Instance.new("Part")
- SpecialMesh13 = Instance.new("SpecialMesh")
- Part14 = Instance.new("Part")
- Part15 = Instance.new("Part")
- Humanoid16 = Instance.new("Humanoid")
- Model0.Name = ""
- Model0.Parent = mas
- Model0.PrimaryPart = Part1
- Part1.Name = "HumanoidRootPart"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(68.1717529, -93.5077972, -119.408203, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Position = Vector3.new(68.1717529, -93.5077972, -119.408203)
- Part1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part1.Transparency = 0.5
- Part1.Size = Vector3.new(2, 2, 1)
- Part1.Anchored = true
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Really black")
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Really black")
- Motor6D2.Name = "Root Hip"
- Motor6D2.Parent = Part1
- Motor6D2.MaxVelocity = 0.10000000149012
- Motor6D2.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.Part0 = Part1
- Motor6D2.Part1 = Part3
- Motor6D2.part1 = Part3
- Part3.Name = "Torso"
- Part3.Parent = Model0
- Part3.CFrame = CFrame.new(68.1717529, -93.5077972, -119.408203, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part3.Position = Vector3.new(68.1717529, -93.5077972, -119.408203)
- Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part3.Size = Vector3.new(2, 2, 1)
- Part3.Anchored = true
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.BrickColor = BrickColor.new("Really black")
- Part3.CanCollide = false
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.brickColor = BrickColor.new("Really black")
- Motor6D4.Name = "Left Hip"
- Motor6D4.Parent = Part3
- Motor6D4.MaxVelocity = 0.10000000149012
- Motor6D4.C0 = CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D4.C1 = CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D4.Part0 = Part3
- Motor6D4.Part1 = Part8
- Motor6D4.part1 = Part8
- Motor6D5.Name = "Right Hip"
- Motor6D5.Parent = Part3
- Motor6D5.MaxVelocity = 0.10000000149012
- Motor6D5.C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D5.C1 = CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D5.Part0 = Part3
- Motor6D5.Part1 = Part9
- Motor6D5.part1 = Part9
- Motor6D6.Name = "Left Shoulder"
- Motor6D6.Parent = Part3
- Motor6D6.MaxVelocity = 0.10000000149012
- Motor6D6.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D6.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D6.Part0 = Part3
- Motor6D6.Part1 = Part10
- Motor6D6.part1 = Part10
- Motor6D7.Name = "Right Shoulder"
- Motor6D7.Parent = Part3
- Motor6D7.MaxVelocity = 0.10000000149012
- Motor6D7.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D7.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D7.Part0 = Part3
- Motor6D7.Part1 = Part11
- Motor6D7.part1 = Part11
- Part8.Name = "Left Leg"
- Part8.Parent = Model0
- Part8.CFrame = CFrame.new(67.6717529, -95.5077972, -119.408203, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
- Part8.Position = Vector3.new(67.6717529, -95.5077972, -119.408203)
- Part8.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part8.Size = Vector3.new(1, 2, 1)
- Part8.Anchored = true
- Part8.BottomSurface = Enum.SurfaceType.Smooth
- Part8.BrickColor = BrickColor.new("Really black")
- Part8.CanCollide = false
- Part8.TopSurface = Enum.SurfaceType.Smooth
- Part8.brickColor = BrickColor.new("Really black")
- Part9.Name = "Right Leg"
- Part9.Parent = Model0
- Part9.CFrame = CFrame.new(68.6717529, -95.5077972, -119.408203, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
- Part9.Position = Vector3.new(68.6717529, -95.5077972, -119.408203)
- Part9.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part9.Size = Vector3.new(1, 2, 1)
- Part9.Anchored = true
- Part9.BottomSurface = Enum.SurfaceType.Smooth
- Part9.BrickColor = BrickColor.new("Really black")
- Part9.CanCollide = false
- Part9.TopSurface = Enum.SurfaceType.Smooth
- Part9.brickColor = BrickColor.new("Really black")
- Part10.Name = "Left Arm"
- Part10.Parent = Model0
- Part10.CFrame = CFrame.new(66.6717529, -93.5077972, -119.408203, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
- Part10.Position = Vector3.new(66.6717529, -93.5077972, -119.408203)
- Part10.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part10.Size = Vector3.new(1, 2, 1)
- Part10.Anchored = true
- Part10.BottomSurface = Enum.SurfaceType.Smooth
- Part10.BrickColor = BrickColor.new("Really black")
- Part10.CanCollide = false
- Part10.TopSurface = Enum.SurfaceType.Smooth
- Part10.brickColor = BrickColor.new("Really black")
- Part11.Name = "Right Arm"
- Part11.Parent = Model0
- Part11.CFrame = CFrame.new(69.6717529, -93.5077972, -119.408203, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
- Part11.Position = Vector3.new(69.6717529, -93.5077972, -119.408203)
- Part11.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part11.Size = Vector3.new(1, 2, 1)
- Part11.Anchored = true
- Part11.BottomSurface = Enum.SurfaceType.Smooth
- Part11.BrickColor = BrickColor.new("Really black")
- Part11.CanCollide = false
- Part11.TopSurface = Enum.SurfaceType.Smooth
- Part11.brickColor = BrickColor.new("Really black")
- Part12.Name = "Head"
- Part12.Parent = Model0
- Part12.CFrame = CFrame.new(68.1717529, -91.9877472, -119.408203, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part12.Position = Vector3.new(68.1717529, -91.9877472, -119.408203)
- Part12.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part12.Size = Vector3.new(1.28000093, 1.29999971, 1.5999999)
- Part12.Anchored = true
- Part12.BottomSurface = Enum.SurfaceType.Smooth
- Part12.BrickColor = BrickColor.new("Really black")
- Part12.TopSurface = Enum.SurfaceType.Smooth
- Part12.brickColor = BrickColor.new("Really black")
- SpecialMesh13.Parent = Part12
- Part14.Name = "Red Eyes"
- Part14.Parent = Part12
- Part14.CFrame = CFrame.new(68.4727325, -91.8777466, -119.943275, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- Part14.Orientation = Vector3.new(0, 90, 0)
- Part14.Position = Vector3.new(68.4727325, -91.8777466, -119.943275)
- Part14.Rotation = Vector3.new(0, 90, 0)
- Part14.Color = Color3.new(1, 0, 0)
- Part14.Size = Vector3.new(0.290000021, 1, 0.340000033)
- Part14.Anchored = true
- Part14.BottomSurface = Enum.SurfaceType.Smooth
- Part14.BrickColor = BrickColor.new("Really red")
- Part14.Material = Enum.Material.Neon
- Part14.TopSurface = Enum.SurfaceType.Smooth
- Part14.brickColor = BrickColor.new("Really red")
- Part14.Shape = Enum.PartType.Cylinder
- Part15.Name = "Red Eyes"
- Part15.Parent = Part12
- Part15.CFrame = CFrame.new(67.8907318, -91.8777466, -119.943275, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- Part15.Orientation = Vector3.new(0, 90, 0)
- Part15.Position = Vector3.new(67.8907318, -91.8777466, -119.943275)
- Part15.Rotation = Vector3.new(0, 90, 0)
- Part15.Color = Color3.new(1, 0, 0)
- Part15.Size = Vector3.new(0.290000021, 1, 0.340000033)
- Part15.Anchored = true
- Part15.BottomSurface = Enum.SurfaceType.Smooth
- Part15.BrickColor = BrickColor.new("Really red")
- Part15.Material = Enum.Material.Neon
- Part15.TopSurface = Enum.SurfaceType.Smooth
- Part15.brickColor = BrickColor.new("Really red")
- Part15.Shape = Enum.PartType.Cylinder
- Humanoid16.Parent = Model0
- Humanoid16.LeftLeg = Part8
- Humanoid16.RightLeg = Part9
- Humanoid16.Torso = Part1
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement