Advertisement
PR0J3CT11

Untitled

Aug 2nd, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. 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 = {}
  3. do
  4. script.Parent = owner.Character
  5. local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
  6. local function NewFakeEvent()
  7. local Bind = Instance.new("BindableEvent")
  8. local Fake;Fake = {Connections = {},
  9. fakeEvent=true;
  10. Connect=function(self,Func)
  11. Bind.Event:connect(Func)
  12. self.Connections[Bind] = true
  13. return setmetatable({Connected = true},{
  14. __index = function (self,Index)
  15. if Index:lower() == "disconnect" then
  16. return function() Fake.Connections[Bind] = false;self.Connected = false end
  17. end
  18. return Fake[Index]
  19. end;
  20. __tostring = function() return "Connection" end;
  21. })
  22. end}
  23. Fake.connect = Fake.Connect;return Fake;
  24. end
  25. local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  26. local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  27. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  28. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  29. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  30. local function TriggerEvent(self,Event,...)
  31. local Trigger = Mouse[Event]
  32. if Trigger and Trigger.fakeEvent and Trigger.Connections then
  33. for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
  34. end
  35. end
  36. Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
  37. Event.OnServerEvent:Connect(function(FiredBy,Input)
  38. if FiredBy.Name ~= owner.Name then return end
  39. if Input.MouseEvent then
  40. Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  41. else
  42. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  43. if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
  44. for _,Action in pairs(ContextActionService.Actions) do
  45. for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  46. end
  47. Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  48. UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  49. end
  50. end)
  51. InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  52. Event.Parent = NLS([[
  53. local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
  54. local Input = function(Input,gameProcessedEvent)
  55. if gameProcessedEvent then return end
  56. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  57. end
  58. UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  59. local Hit,Target
  60. while wait(1/30) do
  61. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  62. Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  63. end
  64. end
  65. ]],owner.Character)
  66. end
  67. RealGame = game;game = setmetatable({},{
  68. __index = function (self,Index)
  69. local Sandbox = function (Thing)
  70. if Thing:IsA("Player") then
  71. local RealPlayer = Thing
  72. return setmetatable({},{
  73. __index = function (self,Index)
  74. local Type = type(RealPlayer[Index])
  75. if Type == "function" then
  76. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  77. return function (self)return InternalData["Mouse"] end
  78. end
  79. return function (self,...)return RealPlayer[Index](RealPlayer,...) end
  80. end
  81. return RealPlayer[Index]
  82. end;
  83. __tostring = function(self) return RealPlayer.Name end
  84. })
  85. end
  86. end
  87. if RealGame[Index] then
  88. local Type = type(RealGame[Index])
  89. if Type == "function" then
  90. if Index:lower() == "getservice" or Index:lower() == "service" then
  91. return function (self,Service)
  92. local FakeServices = {
  93. ["players"] = function()
  94. return setmetatable({},{
  95. __index = function (self2,Index2)
  96. local RealService = RealGame:GetService(Service)
  97. local Type2 = type(Index2)
  98. if Type2 == "function" then
  99. return function (self,...) return RealService[Index2](RealService,...)end
  100. else
  101. if Index2:lower() == "localplayer" then return Sandbox(owner) end
  102. return RealService[Index2]
  103. end
  104. end;
  105. __tostring = function(self) return RealGame:GetService(Service).Name end
  106. })
  107. end;
  108. ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  109. ["userinputservice"] = function() return InternalData["UserInputService"] end;
  110. ["runservice"] = function()
  111. return setmetatable({},{
  112. __index = function(self2,Index2)
  113. local RealService = RealGame:GetService(Service)
  114. local Type2 = type(Index2)
  115. if Type2 == "function" then
  116. return function (self,...) return RealService[Index2](RealService,...) end
  117. else
  118. local RunServices = {
  119. ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  120. ["renderstepped"] = function() return RealService["Stepped"] end
  121. }
  122. if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  123. return RealService[Index2]
  124. end
  125. end
  126. })
  127. end
  128. }
  129. if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  130. return RealGame:GetService(Service)
  131. end
  132. end
  133. return function (self,...) return RealGame[Index](RealGame,...) end
  134. else
  135. if game:GetService(Index) then return game:GetService(Index) end
  136. return RealGame[Index]
  137. end
  138. end
  139. return nil
  140. end
  141. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
  142.  
  143. print("breaking point")
  144.  
  145. Character = owner.Character
  146. LeftArm=Character["Left Arm"]
  147. LeftLeg=Character["Left Leg"]
  148. RightArm=Character["Right Arm"]
  149. RightLeg=Character["Right Leg"]
  150. Root=Character["HumanoidRootPart"]
  151. Torso=Character["Torso"]
  152. Head = Character["Head"]
  153. MseGuide = true
  154. RunSrv = game:GetService("RunService")
  155. RenderStepped = game:GetService("RunService").RenderStepped
  156. removeuseless = game:GetService("Debris")
  157. mouse = owner:GetMouse()
  158.  
  159. function ray(POSITION, DIRECTION, RANGE, IGNOREDECENDANTS)
  160. return workspace:FindPartOnRay(Ray.new(POSITION, DIRECTION.unit * RANGE), IGNOREDECENDANTS)
  161. end
  162.  
  163. function ray2(StartPos, EndPos, Distance, Ignore)
  164. local DIRECTION = CFrame.new(StartPos,EndPos).lookVector
  165. return ray(StartPos, DIRECTION, Distance, Ignore)
  166. end
  167.  
  168. local HEADLERP = Instance.new("ManualWeld")
  169. HEADLERP.Parent = Head
  170. HEADLERP.Part0 = Head
  171. HEADLERP.Part1 = Head
  172. HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
  173.  
  174. local sur = Instance.new("BillboardGui")
  175. sur.Name = "Billboard"
  176. sur.Adornee = Head
  177. sur.Size = UDim2.new(10, 0, 5, 0)
  178. sur.StudsOffset = Vector3.new(0, 5, 0)
  179. local text = Instance.new("TextLabel", sur)
  180. text.Text = ""
  181. text.Size = UDim2.new(1, 0, 1, 0)
  182. text.TextScaled = true
  183. text.BackgroundTransparency = 1
  184. text.Font = Enum.Font.SourceSansLight
  185. text.TextColor3 = Color3.new(1, 1, 1)
  186. text.TextStrokeTransparency = 0
  187.  
  188. Neck = Torso.Neck
  189. OrgnC0 = Neck.C0
  190. local movelimbs = coroutine.wrap(function()
  191. while RunSrv.RenderStepped:wait() do
  192. TrsoLV = Torso.CFrame.lookVector
  193. Dist = nil
  194. Diff = nil
  195. if not MseGuide then
  196. print("Failed to recognize")
  197. else
  198. local _, Point = workspace:FindPartOnRay(Ray.new(Head.CFrame.p, mouse.Hit.lookVector), Workspace, false, true)
  199. Dist = (Head.CFrame.p-Point).magnitude
  200. Diff = Head.CFrame.Y-Point.Y
  201. local _, Point2 = workspace:FindPartOnRay(Ray.new(LeftArm.CFrame.p, mouse.Hit.lookVector), Workspace, false, true)
  202. Dist2 = (LeftArm.CFrame.p-Point).magnitude
  203. Diff2 = LeftArm.CFrame.Y-Point.Y
  204. HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
  205. Neck.C0 = Neck.C0:lerp(OrgnC0*CFrame.Angles((math.tan(Diff/Dist)*1), 0, (((Head.CFrame.p-Point).Unit):Cross(Torso.CFrame.lookVector)).Y*1), .1)
  206. end
  207. end
  208. end)
  209.  
  210. movelimbs()
  211. doit = true
  212. owner.Chatted:connect(function(msg)
  213. if msg == "/disable" then
  214. doit = false
  215. end
  216. if msg == "/enable" then
  217. doit = true
  218. end
  219. end)
  220. while true do
  221. wait()
  222. if doit == true then
  223. sur.Parent = mouse.Target
  224. sur.Adornee = mouse.Target
  225. text.Text = ""
  226. else
  227. sur.Adornee = workspace
  228. end
  229. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement