Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 torch(target)
- target:FindFirstChildOfClass("Humanoid").PlatformStand = true
- target.Head:ClearAllChildren()
- for i,v in pairs(target:GetDescendants()) do
- if v.ClassName == "Decal" or v.ClassName == "Texture" then
- v:Destroy()
- end
- end
- for i,v in pairs(target:GetDescendants()) do
- if v.ClassName == "Part" or v.ClassName == "MeshPart" then
- if v.Name ~= "Torso" and v.Name ~= "Head" and v.Name ~= "HumanoidRootPart" and v.Name ~= "UpperTorso" then
- v:Destroy()
- end
- end
- end
- for i,v in pairs(target:GetDescendants()) do
- if v.ClassName == "Part" or v.ClassName == "MeshPart" then
- if v.Name ~= "Head" then
- v.Size = Vector3.new(0,0,0)
- v.Transparency = 1
- v.Anchored = false
- --v.CFrame = mas.CFrame
- v.Massless = true
- --local cf = mas.CFrame
- vweld = Instance.new("Weld",v)
- vweld.Part0 = target.Head
- vweld.Part1 = v
- --mas.CFrame = cf
- end
- end
- end
- Part0 = target.Head
- Decal1 = Instance.new("Decal")
- Decal2 = Instance.new("Decal")
- Decal3 = Instance.new("Decal")
- Decal4 = Instance.new("Decal")
- Decal5 = Instance.new("Decal")
- Texture6 = Instance.new("Texture")
- BillboardGui7 = Instance.new("BillboardGui")
- Frame8 = Instance.new("Frame")
- Frame9 = Instance.new("Frame")
- TextLabel10 = Instance.new("TextLabel")
- TextLabel11 = Instance.new("TextLabel")
- Script12 = Instance.new("Script")
- --Part0.CFrame = CFrame.new(0.276227981, 17.71558, 24.3168869, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- --Part0.Orientation = Vector3.new(0, 90, 0)
- --Part0.Position = Vector3.new(0.276227981, 17.71558, 24.3168869)
- --Part0.Rotation = Vector3.new(0, 90, 0)
- Part0.Color = Color3.new(0.94902, 0.952941, 0.952941)
- Part0.Size = Vector3.new(0.399999678, 2, 0.399999917)
- Part0.BackSurface = Enum.SurfaceType.Studs
- Part0.BrickColor = BrickColor.new("White")
- Part0.FrontSurface = Enum.SurfaceType.Studs
- Part0.LeftParamA = 0
- Part0.LeftParamB = 0
- Part0.LeftSurface = Enum.SurfaceType.Studs
- Part0.RightParamA = 0
- Part0.RightParamB = 0
- Part0.RightSurface = Enum.SurfaceType.Studs
- Part0.brickColor = BrickColor.new("White")
- Part0.FormFactor = Enum.FormFactor.Symmetric
- Part0.formFactor = Enum.FormFactor.Symmetric
- Decal1.Parent = Part0
- Decal1.Texture = "http://www.roblox.com/asset/?id=61211168"
- Decal1.Transparency = 0.30000001192093
- Decal1.Face = Enum.NormalId.Top
- Decal2.Parent = Part0
- Decal2.Texture = "http://www.roblox.com/asset/?id=61211135"
- Decal2.Transparency = 0.30000001192093
- Decal2.Face = Enum.NormalId.Right
- Decal3.Parent = Part0
- Decal3.Texture = "http://www.roblox.com/asset/?id=61211135"
- Decal3.Transparency = 0.30000001192093
- Decal3.Face = Enum.NormalId.Left
- Decal4.Parent = Part0
- Decal4.Texture = "http://www.roblox.com/asset/?id=61211135"
- Decal4.Transparency = 0.30000001192093
- Decal5.Parent = Part0
- Decal5.Texture = "http://www.roblox.com/asset/?id=61211135"
- Decal5.Transparency = 0.30000001192093
- Decal5.Face = Enum.NormalId.Back
- Texture6.Parent = Part0
- Texture6.Texture = "http://www.roblox.com/asset/?id=15845700"
- Texture6.Transparency = 0.30000001192093
- Texture6.Face = Enum.NormalId.Bottom
- Texture6.StudsPerTileU = 4
- Texture6.StudsPerTileV = 4
- BillboardGui7.Name = "NametagGui"
- BillboardGui7.Parent = Part0
- BillboardGui7.Size = UDim2.new(1.25, 0, 1, 0)
- BillboardGui7.StudsOffset = Vector3.new(0, 2, 0)
- Frame8.Parent = BillboardGui7
- Frame8.Position = UDim2.new(0, 0, 0, 3)
- Frame8.Size = UDim2.new(1, 0, 1, -6)
- Frame8.BackgroundColor = BrickColor.new("Black")
- Frame8.BackgroundColor3 = Color3.new(0.160784, 0.160784, 0.160784)
- Frame8.BackgroundTransparency = 0.20000000298023
- Frame8.BorderSizePixel = 0
- Frame9.Name = "SizingFrame"
- Frame9.Parent = Frame8
- Frame9.Position = UDim2.new(0, 4, 0, 4)
- Frame9.Size = UDim2.new(1, -8, 1, -8)
- Frame9.BackgroundColor = BrickColor.new("Institutional white")
- Frame9.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame9.BackgroundTransparency = 1
- Frame9.BorderSizePixel = 0
- TextLabel10.Name = "TextShadow"
- TextLabel10.Parent = Frame9
- TextLabel10.Position = UDim2.new(0, 2, 0, 2)
- TextLabel10.Size = UDim2.new(1, 0, 1, 0)
- TextLabel10.BackgroundTransparency = 1
- TextLabel10.BorderSizePixel = 0
- TextLabel10.Text = "Torch"
- TextLabel10.TextColor = BrickColor.new("Really black")
- TextLabel10.TextColor3 = Color3.new(0, 0, 0)
- TextLabel10.TextScaled = true
- TextLabel10.TextWrap = true
- TextLabel10.TextWrapped = true
- TextLabel11.Name = "NormalText"
- TextLabel11.Parent = TextLabel10
- TextLabel11.Position = UDim2.new(0, -2, 0, -2)
- TextLabel11.Size = UDim2.new(1, 0, 1, 0)
- TextLabel11.BackgroundTransparency = 1
- TextLabel11.BorderSizePixel = 0
- TextLabel11.Text = "Torch"
- TextLabel11.TextColor = BrickColor.new("Institutional white")
- TextLabel11.TextColor3 = Color3.new(1, 1, 1)
- TextLabel11.TextScaled = true
- TextLabel11.TextWrap = true
- TextLabel11.TextWrapped = true
- Script12.Name = "NametagScript"
- Script12.Parent = BillboardGui7
- end
- mouse = game.Players.LocalPlayer:GetMouse()
- mouse.Button1Down:Connect(function()
- if mouse.Target.Parent:FindFirstChildOfClass("Humanoid") then
- torch(mouse.Target.Parent)
- end
- end)
Add Comment
Please, Sign In to add comment