SHARE
TWEET

cloner

HenloMyDude Aug 26th, 2019 (edited) 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by WaverlyCole");InternalData = {}
  2. do
  3.     script.Parent = owner.Character
  4.     local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
  5.     local function NewFakeEvent()
  6.         local Bind = Instance.new("BindableEvent")
  7.         local Fake;Fake = {Connections = {},
  8.         fakeEvent=true;
  9.         Connect=function(self,Func)
  10.             Bind.Event:connect(Func)
  11.             self.Connections[Bind] = true
  12.             return setmetatable({Connected = true},{
  13.             __index = function (self,Index)
  14.                 if Index:lower() == "disconnect" then
  15.                     return function() Fake.Connections[Bind] = false;self.Connected = false end
  16.                 end
  17.                 return Fake[Index]
  18.             end;
  19.             __tostring = function() return "Connection" end;
  20.         })
  21.         end}
  22.         Fake.connect = Fake.Connect;return Fake;
  23.     end
  24.     local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  25.     local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  26.     local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  27.         self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  28.     end};ContextActionService.UnBindAction = ContextActionService.BindAction
  29.     local function TriggerEvent(self,Event,...)
  30.         local Trigger = Mouse[Event]
  31.         if Trigger and Trigger.fakeEvent and Trigger.Connections then
  32.             for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
  33.         end
  34.     end
  35.     Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
  36.     Event.OnServerEvent:Connect(function(FiredBy,Input)
  37.         if FiredBy.Name ~= owner.Name then return end
  38.         if Input.MouseEvent then
  39.             Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  40.         else
  41.             local Begin = Input.UserInputState == Enum.UserInputState.Begin
  42.             if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
  43.             for _,Action in pairs(ContextActionService.Actions) do
  44.                 for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  45.             end
  46.             Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  47.             UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  48.         end
  49.     end)
  50.     InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  51.     Event.Parent = NLS([[
  52.         local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
  53.         local Input = function(Input,gameProcessedEvent)
  54.             if gameProcessedEvent then return end
  55.             Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  56.         end
  57.         UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  58.         local Hit,Target
  59.         while wait(1/30) do
  60.             if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  61.                 Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  62.             end
  63.         end
  64.     ]],owner.Character)
  65. end
  66. RealGame = game;game = setmetatable({},{
  67.     __index = function (self,Index)
  68.         local Sandbox = function (Thing)
  69.             if Thing:IsA("Player") then
  70.                 local RealPlayer = Thing
  71.                 return setmetatable({},{
  72.                     __index = function (self,Index)
  73.                         local Type = type(RealPlayer[Index])
  74.                         if Type == "function" then
  75.                             if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  76.                                 return function (self)return InternalData["Mouse"] end
  77.                             end
  78.                             return function (self,...)return RealPlayer[Index](RealPlayer,...) end
  79.                         end
  80.                         return RealPlayer[Index]
  81.                     end;
  82.                     __tostring = function(self) return RealPlayer.Name end
  83.                 })
  84.             end
  85.         end
  86.         if RealGame[Index] then
  87.             local Type = type(RealGame[Index])
  88.             if Type == "function" then
  89.                 if Index:lower() == "getservice" or Index:lower() == "service" then
  90.                     return function (self,Service)
  91.                         local FakeServices = {
  92.                             ["players"] = function()
  93.                                 return setmetatable({},{
  94.                                     __index = function (self2,Index2)
  95.                                         local RealService = RealGame:GetService(Service)
  96.                                         local Type2 = type(Index2)
  97.                                         if Type2 == "function" then
  98.                                             return function (self,...) return RealService[Index2](RealService,...)end
  99.                                         else
  100.                                             if Index2:lower() == "localplayer" then return Sandbox(owner) end
  101.                                             return RealService[Index2]
  102.                                         end
  103.                                     end;
  104.                                     __tostring = function(self) return RealGame:GetService(Service).Name end
  105.                                 })
  106.                             end;
  107.                             ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  108.                             ["userinputservice"] = function() return InternalData["UserInputService"] end;
  109.                             ["runservice"] = function()
  110.                                 return setmetatable({},{
  111.                                     __index = function(self2,Index2)
  112.                                         local RealService = RealGame:GetService(Service)
  113.                                         local Type2 = type(Index2)
  114.                                         if Type2 == "function" then
  115.                                             return function (self,...) return RealService[Index2](RealService,...) end
  116.                                         else
  117.                                             local RunServices = {
  118.                                                 ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  119.                                                 ["renderstepped"] = function() return RealService["Stepped"] end
  120.                                             }
  121.                                             if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  122.                                             return RealService[Index2]
  123.                                         end
  124.                                     end
  125.                                 })
  126.                             end
  127.                         }
  128.                         if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  129.                         return RealGame:GetService(Service)
  130.                     end
  131.                 end
  132.                 return function (self,...) return RealGame[Index](RealGame,...) end
  133.             else
  134.                 if game:GetService(Index) then return game:GetService(Index) end
  135.                 return RealGame[Index]
  136.             end
  137.         end
  138.         return nil
  139.     end
  140. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
  141.  
  142. plr = owner
  143. mouse = plr:GetMouse()
  144. char = plr.Character
  145. follow = true
  146. char.Archivable = true
  147. parentooh = workspace
  148. deathwait = 1
  149.  
  150. function clone()
  151.     local cloned = char:Clone()
  152.     cloned.Name = owner.Name .." "
  153.     cloned.Parent = parentooh
  154.    
  155.     cloned:FindFirstChildOfClass("Humanoid").Died:connect(function()
  156.         wait(deathwait)
  157.         cloned:Destroy()
  158.     end)
  159.    
  160.     coroutine.resume(coroutine.create(function()
  161.         while true do
  162.             wait(0.25)
  163.             if follow == true then
  164.                 cloned.Humanoid.WalkToPoint = char.HumanoidRootPart.Position
  165.             end
  166.             if char.Humanoid.Jump == true then
  167.                 cloned.Humanoid.Jump = true
  168.             end
  169.         end
  170.     end))
  171. end
  172.  
  173. function clonesword()
  174.     local cloned = char:Clone()
  175.     cloned.Name = owner.Name .." "
  176.     cloned.Parent = parentooh
  177.  
  178. --------------------------
  179.  
  180. local handle = Instance.new("Part",cloned)
  181. handle.Name = "Handle"
  182. handle.Size = Vector3.new(1, 0.8, 4)
  183. handle.Reflectance = 0.4
  184. handle.BrickColor = BrickColor.new("Dark stone grey")
  185. local mesh = Instance.new("SpecialMesh",handle)
  186. mesh.Name = "Mesh"
  187. mesh.MeshType = "FileMesh"
  188. mesh.MeshId = "rbxasset://fonts/sword.mesh"
  189. mesh.TextureId = "rbxasset://textures/SwordTexture.png"
  190. local weld = Instance.new("Weld",handle)
  191. weld.Part0 = handle
  192. weld.Part1 = cloned["Right Arm"]
  193. weld.C0 = CFrame.new(0, -1, -1.25) * CFrame.Angles(77 + 77, 0, 0)
  194.  
  195. --------------------------
  196. --added stuff for damage--
  197.  
  198. handle.Touched:connect(function(hit)
  199.     for _,v in pairs (hit.Parent:children()) do
  200.         if hit.Parent ~= char and hit.Parent ~= cloned and hit.Parent.Name ~= cloned.Name then
  201.             if v:IsA("Humanoid") then
  202.                 v.Health = v.Health - 5
  203.             end
  204.         end
  205.     end
  206. end)
  207.  
  208. --------------------------
  209.  
  210.  
  211.     cloned:FindFirstChildOfClass("Humanoid").Died:connect(function()
  212.         wait(deathwait)
  213.         cloned:Destroy()
  214.     end)
  215.    
  216.     coroutine.resume(coroutine.create(function()
  217.         while true do
  218.             wait(0.25)
  219.             if follow == true then
  220.                 cloned.Humanoid.WalkToPoint = char.HumanoidRootPart.Position
  221.             end
  222.             if char.Humanoid.Jump == true then
  223.                 cloned.Humanoid.Jump = true
  224.             end
  225.             if not handle then
  226. local handle = Instance.new("Part",cloned)
  227. handle.Name = "Handle"
  228. handle.Size = Vector3.new(1, 0.8, 4)
  229. handle.Reflectance = 0.4
  230. handle.BrickColor = BrickColor.new("Dark stone grey")
  231. local mesh = Instance.new("SpecialMesh",handle)
  232. mesh.Name = "Mesh"
  233. mesh.MeshType = "FileMesh"
  234. mesh.MeshId = "rbxasset://fonts/sword.mesh"
  235. mesh.TextureId = "rbxasset://textures/SwordTexture.png"
  236. local weld = Instance.new("Weld",handle)
  237. weld.Part0 = handle
  238. weld.Part1 = cloned["Right Arm"]
  239. weld.C0 = CFrame.new(0, -1, -1.25) * CFrame.Angles(77 + 77, 0, 0)
  240.             end
  241.         end
  242.     end))
  243. end
  244.  
  245. mouse.Button1Down:connect(function()
  246.    
  247. end)
  248.  
  249. mouse.KeyDown:connect(function(key)
  250.     key=key:lower()
  251.     if key == "f" then
  252.         for _,v in pairs (parentooh:children()) do
  253.             if v:IsA("Model") and v.Name == owner.Name .." " then
  254.                 v.Humanoid.Jump = true
  255.             end
  256.         end
  257.     end
  258.     if key == "p" then
  259.         for _,v in pairs (parentooh:children()) do
  260.             if v:IsA("Model") and v.Name == owner.Name .." " then
  261.                 v:Destroy()
  262.             end
  263.         end
  264.     end
  265.     if key == "v" then
  266.         clonesword()
  267.     end
  268.     if key == "c" then
  269.         clone()
  270.     end
  271.     if key == "g" then
  272.         follow = false
  273.         for _,v in pairs (parentooh:children()) do
  274.             if v:IsA("Model") and v.Name == owner.Name .." " then
  275.                 repeat
  276.                 wait()
  277.                 for _,v in pairs (parentooh:children()) do
  278.                     if v:IsA("Model") and v.Name == owner.Name .." " then
  279.                         v.Humanoid.WalkToPoint = mouse.Hit.p
  280.                     end
  281.                 end
  282.                 until follow == true
  283.                 follow = true
  284.             end
  285.         end
  286.     end
  287. end)
  288.  
  289. mouse.KeyUp:connect(function(key)
  290.     key=key:lower()
  291.     if key == "g" then
  292.         follow = true
  293.     end
  294. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top