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
- arrivedtexts = {"Arrived here to serve justice.","I hope not much criminals are around here.","Come out criminals, check out your new trip to hell!","Don't you dare break the rules, or else hell will never realease you loose."}
- prearresttexts = {"Get over here!","Stop, police here!","You got caught!","HEY!","YOU LITTLE PUNK!","*insert swear word here*-ING COME HERE!","Come here!","...hey sonny, you fowgwot youw hat for the go...Eh, nobody gets this trick."}
- arresttexts = {"Gotta arrest someone real quick...","I hope you're scared, because the prison you're going to is called...'hell'.","Handcuffs on!","Prepare to get arrested!","I hope there are less criminals around the world now...","Don't get cocky!","And stay down!","Anything you say can and WILL be used against you.","you're making everyone sad ( ͡° ʖ̯ ͡°)"}
- arrested = {}
- handcuffs = {}
- wait(1)
- victim = nil
- lp = game.Players.LocalPlayer
- char = lp.Character
- hellbase = Instance.new("Part",char)
- hellbase.Size = Vector3.new(2048,1,2048)
- hellbase.BrickColor = BrickColor.new("Really red")
- hellbase.Material = Enum.Material.Slate
- hellbase.Anchored = true
- hellbase.CFrame = CFrame.new(0,2048,0)
- torso = nil
- gc = char:GetChildren()
- char:FindFirstChildOfClass("Humanoid").WalkSpeed = 25
- hum = char:FindFirstChildOfClass("Humanoid")
- for i=1, #gc do
- if gc[i].ClassName == "Shirt" or gc[i].ClassName == "Pants" or gc[i].ClassName == "ShirtGraphic" or gc[i].ClassName == "ShirtGraphics" then
- gc[i]:Destroy()
- end
- end
- if char:FindFirstChildOfClass("BodyColors") then
- char:FindFirstChildOfClass("BodyColors"):Destroy()
- end
- newbc = Instance.new("BodyColors",char)
- newbc.TorsoColor = BrickColor.new("Bright red")
- newbc.LeftArmColor = BrickColor.new("Bright red")
- newbc.RightArmColor = BrickColor.new("Bright red")
- newbc.LeftLegColor = BrickColor.new("Medium red")
- newbc.RightLegColor = BrickColor.new("Medium red")
- head = char.Head
- ft = char:FindFirstChild("Torso")
- if ft then
- torso = ft
- elseif char:FindFirstChild("UpperTorso") then
- torso = char:FindFirstChild("UpperTorso")
- end
- bgui = Instance.new("BillboardGui",torso)
- bgui.Name = "TextGui"
- bgui.Size = UDim2.new(0,500,0,1000)
- bgui.Adornee = torso
- text = Instance.new("TextLabel",bgui)
- text.BackgroundTransparency = 1
- text.Size = UDim2.new(0,500,0,100)
- text.Position = UDim2.new(0,0,0,250)
- text.TextColor3 = Color3.new(1,1,1)
- text.Font = Enum.Font.Antique
- text.Text = lp.Name.."\nthe Police from hell"
- text.TextScaled = true
- function changetext(msg)
- for ct=1, string.len(msg) do
- wait(0.01)
- text.Text = string.sub(msg,1,ct)
- end
- wait(2)
- for ct=1, string.len(msg) do
- wait(0.01)
- text.Text = string.sub(msg,1,string.len(msg)-ct)
- end
- text.Text = lp.Name.."\nthe Police from hell"
- end
- lp:GetMouse().Button1Down:connect(function()
- target = lp:GetMouse().Target
- if target.Parent:FindFirstChildOfClass("Humanoid") then
- victim = target.Parent
- hum.WalkToPoint = victim.Head.Position
- changetext(prearresttexts[math.random(1,#prearresttexts)])
- repeat
- wait(0.01)
- hum.WalkToPoint = victim.Head.Position
- until (head.Position - victim.Head.Position).magnitude < 5
- head.Anchored = true
- victim.Head.Anchored = true
- table.insert(arrested,1,victim)
- ft = victim:FindFirstChildOfClass("Tool")
- if ft then
- ft:Destroy()
- end
- hc = Instance.new("Tool",workspace)
- table.insert(handcuffs,1,hc)
- hc.CanBeDropped = false
- hc.Name = "Handcuffs"
- handle = Instance.new("Part",hc)
- handle.Name = "Handle"
- handle.Size = Vector3.new(5,1,1)
- hc.Parent = victim
- changetext(arresttexts[math.random(1,#arresttexts)])
- victim.Head.Anchored = false
- head.Anchored = false
- victim.Head.CFrame = hellbase.CFrame + Vector3.new(0,35,0)
- end
- end)
- changetext(arrivedtexts[math.random(1,#arrivedtexts)])
- hum.Died:connect(function()
- cframe = head.CFrame
- lp:LoadCharacter()
- wait(1)
- lp.Character.Head.CFrame = cframe
- error("oops you died")
- end)
- while true do
- wait(0.01)
- hum.Health = hum.MaxHealth
- for ar=1, #arrested do
- if arrested[ar] ~= nil then
- if handcuffs[ar] ~= nil then
- handcuffs[ar].Parent = arrested[ar]
- end
- if (arrested[ar].Head.Position - hellbase.Position).magnitude > 25 then
- arrested[ar].Head.CFrame = hellbase.CFrame + Vector3.new(0,10,0)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement