Advertisement
HenloMyDude

robot

Aug 19th, 2019
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.91 KB | None | 0 0
  1.  
  2.  
  3. 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 = {}
  4. do
  5. script.Parent = owner.Character
  6. local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
  7. local function NewFakeEvent()
  8. local Bind = Instance.new("BindableEvent")
  9. local Fake;Fake = {Connections = {},
  10. fakeEvent=true;
  11. Connect=function(self,Func)
  12. Bind.Event:connect(Func)
  13. self.Connections[Bind] = true
  14. return setmetatable({Connected = true},{
  15. __index = function (self,Index)
  16. if Index:lower() == "disconnect" then
  17. return function() Fake.Connections[Bind] = false;self.Connected = false end
  18. end
  19. return Fake[Index]
  20. end;
  21. __tostring = function() return "Connection" end;
  22. })
  23. end}
  24. Fake.connect = Fake.Connect;return Fake;
  25. end
  26. local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  27. local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  28. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  29. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  30. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  31. local function TriggerEvent(self,Event,...)
  32. local Trigger = Mouse[Event]
  33. if Trigger and Trigger.fakeEvent and Trigger.Connections then
  34. for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
  35. end
  36. end
  37. Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
  38. Event.OnServerEvent:Connect(function(FiredBy,Input)
  39. if FiredBy.Name ~= owner.Name then return end
  40. if Input.MouseEvent then
  41. Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  42. else
  43. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  44. if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
  45. for _,Action in pairs(ContextActionService.Actions) do
  46. for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  47. end
  48. Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  49. UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  50. end
  51. end)
  52. InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  53. Event.Parent = NLS([[
  54. local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
  55. local Input = function(Input,gameProcessedEvent)
  56. if gameProcessedEvent then return end
  57. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  58. end
  59. UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  60. local Hit,Target
  61. while wait(1/30) do
  62. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  63. Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  64. end
  65. end
  66. ]],owner.Character)
  67. end
  68. RealGame = game;game = setmetatable({},{
  69. __index = function (self,Index)
  70. local Sandbox = function (Thing)
  71. if Thing:IsA("Player") then
  72. local RealPlayer = Thing
  73. return setmetatable({},{
  74. __index = function (self,Index)
  75. local Type = type(RealPlayer[Index])
  76. if Type == "function" then
  77. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  78. return function (self)return InternalData["Mouse"] end
  79. end
  80. return function (self,...)return RealPlayer[Index](RealPlayer,...) end
  81. end
  82. return RealPlayer[Index]
  83. end;
  84. __tostring = function(self) return RealPlayer.Name end
  85. })
  86. end
  87. end
  88. if RealGame[Index] then
  89. local Type = type(RealGame[Index])
  90. if Type == "function" then
  91. if Index:lower() == "getservice" or Index:lower() == "service" then
  92. return function (self,Service)
  93. local FakeServices = {
  94. ["players"] = function()
  95. return setmetatable({},{
  96. __index = function (self2,Index2)
  97. local RealService = RealGame:GetService(Service)
  98. local Type2 = type(Index2)
  99. if Type2 == "function" then
  100. return function (self,...) return RealService[Index2](RealService,...)end
  101. else
  102. if Index2:lower() == "localplayer" then return Sandbox(owner) end
  103. return RealService[Index2]
  104. end
  105. end;
  106. __tostring = function(self) return RealGame:GetService(Service).Name end
  107. })
  108. end;
  109. ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  110. ["userinputservice"] = function() return InternalData["UserInputService"] end;
  111. ["runservice"] = function()
  112. return setmetatable({},{
  113. __index = function(self2,Index2)
  114. local RealService = RealGame:GetService(Service)
  115. local Type2 = type(Index2)
  116. if Type2 == "function" then
  117. return function (self,...) return RealService[Index2](RealService,...) end
  118. else
  119. local RunServices = {
  120. ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  121. ["renderstepped"] = function() return RealService["Stepped"] end
  122. }
  123. if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  124. return RealService[Index2]
  125. end
  126. end
  127. })
  128. end
  129. }
  130. if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  131. return RealGame:GetService(Service)
  132. end
  133. end
  134. return function (self,...) return RealGame[Index](RealGame,...) end
  135. else
  136. if game:GetService(Index) then return game:GetService(Index) end
  137. return RealGame[Index]
  138. end
  139. end
  140. return nil
  141. end
  142. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
  143.  
  144. script.Parent = workspace
  145.  
  146. plr = owner
  147. char = plr.Character
  148. RootPart = char.HumanoidRootPart
  149. mouse = plr:GetMouse()
  150. hum = char.Humanoid
  151. local idleanim = Instance.new("Animation")
  152. idleanim.Name = "Roblox Idle Animation"
  153. idleanim.AnimationId = "http://www.roblox.com/asset/?id=180435571"
  154. local idleanimplay = hum:LoadAnimation(idleanim)
  155.  
  156. local RS = char.Torso["Right Shoulder"]
  157. local LS = char.Torso["Left Shoulder"]
  158. local RH = char.Torso["Right Hip"]
  159. local LH = char.Torso["Left Hip"]
  160. local neck = char.Torso["Neck"]
  161.  
  162. local rootj = Instance.new("Weld",char.Torso)
  163. rootj.Part0 = char.Torso
  164. rootj.Part1 = RootPart
  165.  
  166.  
  167. local RSnor = RS.C0
  168. local LSnor = LS.C0
  169. local RHnor = RH.C0
  170. local LHnor = LH.C0
  171. local rootjnor = rootj.C0
  172. local necknor = neck.C0
  173.  
  174. IT = Instance.new
  175. CF = CFrame.new
  176. VT = Vector3.new
  177. RAD = math.rad
  178. C3 = Color3.new
  179. UD2 = UDim2.new
  180. BRICKC = BrickColor.new
  181. ANGLES = CFrame.Angles
  182. EULER = CFrame.fromEulerAnglesXYZ
  183. COS = math.cos
  184. ACOS = math.acos
  185. SIN = math.sin
  186. ASIN = math.asin
  187. ABS = math.abs
  188. MRANDOM = math.random
  189. FLOOR = math.floor
  190.  
  191. function turnto(position)
  192. RootPart.CFrame=CFrame.new(RootPart.CFrame.p,VT(position.X,RootPart.Position.Y,position.Z)) * CFrame.new(0, 0, 0)
  193. end
  194.  
  195. for _,v in pairs (char:children()) do
  196. if v:IsA("Part") then
  197. v.Material = "DiamondPlate"
  198. v.BrickColor = BrickColor.new("Medium stone grey")
  199. if v.Name == "Head" then
  200. v.Mesh.MeshType = "Brick"
  201. v.Mesh.Scale = Vector3.new(0.5, 1, 1)
  202. end
  203. end
  204. if v:IsA("Shirt") or v:IsA("Pants") then
  205. v:Destroy()
  206. end
  207. if v:IsA("Accessory") then
  208. for _,v in pairs (v:children()) do
  209. if v:IsA("Part") then
  210. v.Mesh.TextureId = ""
  211. v.Material = "DiamondPlate"
  212.  
  213. for _,v in pairs (v:children()) do
  214. if v:IsA("Part") then
  215. v.Mesh.TextureId = ""
  216. v.Material = "DiamondPlate"
  217. end
  218. end
  219. end
  220. end
  221. end
  222. end
  223.  
  224. --Character--
  225.  
  226. function CreatePart(FORMFACTOR, PARENT, POS, MATERIAL, REFLECTANCE, TRANSPARENCY, BRICKCOLOR, NAME, SIZE, ANCHOR)
  227. local NEWPART = IT("Part")
  228. NEWPART.formFactor = FORMFACTOR
  229. NEWPART.Reflectance = REFLECTANCE
  230. NEWPART.Transparency = TRANSPARENCY
  231. NEWPART.CanCollide = false
  232. NEWPART.Locked = true
  233. NEWPART.Anchored = true
  234. if ANCHOR == false then
  235. NEWPART.Anchored = false
  236. end
  237. NEWPART.BrickColor = BRICKC(tostring(BRICKCOLOR))
  238. NEWPART.Name = NAME
  239. NEWPART.Size = SIZE
  240. NEWPART.Position = POS
  241. NEWPART.Material = MATERIAL
  242. NEWPART:BreakJoints()
  243. NEWPART.Parent = PARENT
  244. return NEWPART
  245. end
  246.  
  247. function CreateWeldOrSnapOrMotor(TYPE, PARENT, PART0, PART1, C0, C1)
  248. local NEWWELD = IT(TYPE)
  249. NEWWELD.Part0 = PART0
  250. NEWWELD.Part1 = PART1
  251. NEWWELD.C0 = C0
  252. NEWWELD.C1 = C1
  253. NEWWELD.Parent = PARENT
  254. return NEWWELD
  255. end
  256.  
  257. function ezweld(P1,P2,CFRAME)
  258. local ezwelda = CreateWeldOrSnapOrMotor("Weld",char,P1,P2,CFRAME,CF(0,0,0))
  259. return ezwelda
  260. end
  261.  
  262. function CreateMesh(MESH, PARENT, MESHTYPE, MESHID, TEXTUREID, SCALE, OFFSET)
  263. local NEWMESH = IT(MESH)
  264. if MESH == "SpecialMesh" then
  265. NEWMESH.MeshType = MESHTYPE
  266. if MESHID ~= "nil" and MESHID ~= "" then
  267. NEWMESH.MeshId = "http://www.roblox.com/asset/?id="..MESHID
  268. end
  269. if TEXTUREID ~= "nil" and TEXTUREID ~= "" then
  270. NEWMESH.TextureId = "http://www.roblox.com/asset/?id="..TEXTUREID
  271. end
  272. end
  273. NEWMESH.Offset = OFFSET or VT(0, 0, 0)
  274. NEWMESH.Scale = SCALE
  275. NEWMESH.Parent = PARENT
  276. return NEWMESH
  277. end
  278.  
  279. local Chest1 = CreatePart(3,char,char.Torso.Position,"Neon",0,0,"Really black","ChestPart",VT(1.5, 1, 0.25),false)
  280. local Chest1Weld = ezweld(Chest1,char.Torso,CF(0,-0.25,-0.5))
  281. local Chest1Mesh = CreateMesh("SpecialMesh",Chest1,"Sphere","nil","nil",VT(1, 1, 1),VT(0, 0, 0))
  282.  
  283. local Chest2 = CreatePart(3,char,char.Torso.Position,"Neon",0,0,"Really black","ChestPart",VT(0.5, 0.5, 0.25),false)
  284. local Chest2Weld = ezweld(Chest2,char.Torso,CF(0,-0.25,0.5))
  285. local Chest2Mesh = CreateMesh("SpecialMesh",Chest2,"Sphere","nil","nil",VT(1, 1, 1),VT(0, 0, 0))
  286.  
  287. local Arm1 = CreatePart(3,char,char["Right Arm"].Position,"Neon",0,0,"Really blue","ArmPart",VT(0.1, 0.5, 0.5),false)
  288. local Arm1Weld = ezweld(Arm1,char["Right Arm"],CF(-0.5,0,0))
  289. local Arm1Mesh = CreateMesh("SpecialMesh",Arm1,"Sphere","nil","nil",VT(1, 1, 1),VT(0, 0, 0))
  290.  
  291. local Arm2 = CreatePart(3,char,char["Left Arm"].Position,"Neon",0,0,"Really blue","ArmPart",VT(0.1, 0.5, 0.5),false)
  292. local Arm2Weld = ezweld(Arm2,char["Left Arm"],CF(0.5,0,0))
  293. local Arm2Mesh = CreateMesh("SpecialMesh",Arm2,"Sphere","nil","nil",VT(1, 1, 1),VT(0, 0, 0))
  294.  
  295. local Leg1 = CreatePart(3,char,char["Right Leg"].Position,"Neon",0,0,"Really blue","ArmPart",VT(0.1, 1.5, 0.5),false)
  296. local Leg1Weld = ezweld(Leg1,char["Right Leg"],CF(-0.5,0,0))
  297. local Leg1Mesh = CreateMesh("SpecialMesh",Leg1,"Sphere","nil","nil",VT(1, 1, 1),VT(0, 0, 0))
  298.  
  299. local Leg2 = CreatePart(3,char,char["Left Leg"].Position,"Neon",0,0,"Really blue","ArmPart",VT(0.1, 1.5, 0.5),false)
  300. local Leg2Weld = ezweld(Leg2,char["Left Leg"],CF(0.5,0,0))
  301. local Leg2Mesh = CreateMesh("SpecialMesh",Leg2,"Sphere","nil","nil",VT(1, 1, 1),VT(0, 0, 0))
  302.  
  303.  
  304.  
  305.  
  306. normalanim = true
  307. sine=0
  308. char.Humanoid.Animator:Destroy()
  309.  
  310. while game:GetService("RunService").Heartbeat:Wait() do
  311. if normalanim then
  312. sine = sine + 1
  313. end
  314. local touchfloor = workspace:FindPartOnRay(Ray.new(char.HumanoidRootPart.CFrame.Position, ((CFrame.new(char.HumanoidRootPart.Position, char.HumanoidRootPart.Position - Vector3.new(0, 1, 0))).LookVector).Unit * 4), char)
  315. if char.HumanoidRootPart.Velocity.Magnitude > 1 and touchfloor then
  316. animpose = "Walking"
  317. elseif char.HumanoidRootPart.Velocity.Y > 0.5 and touchfloor == nil then
  318. animpose = "Jumping"
  319. elseif char.HumanoidRootPart.Velocity.Y < 0.5 and touchfloor == nil then
  320. animpose = "Falling"
  321. else
  322. animpose = "Idle"
  323. end
  324. if animpose == "Idle" and normalanim then
  325. RS.C0 = RS.C0:Lerp(RSnor * CFrame.new(0, 0, 0) * CFrame.Angles(-0.5 - 0.25 * COS(sine / 12), 0, 0), 0.15)
  326. LS.C0 = LS.C0:Lerp(LSnor * CFrame.new(0, 0, 0) * CFrame.Angles(-0.5 - 0.25 * COS(sine / 12), 0, 0), 0.15)
  327. RH.C0 = RH.C0:Lerp(RHnor * CFrame.new(0, 0, 0), 0.15)
  328. LH.C0 = LH.C0:Lerp(LHnor * CFrame.new(-0.5, 0.5 + 0.25 * COS(sine / 12), 0), 0.15)
  329. rootj.C0 = rootj.C0:Lerp(CFrame.new(0, -3 - 0.1 * COS(sine / 12), 0), 0.15)
  330. neck.C0 = neck.C0:Lerp(necknor * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), 0.15)
  331. elseif animpose == "Walking" and normalanim then
  332. RS.C0 = RS.C0:Lerp(RSnor * CFrame.new(0, 0, 0) * CFrame.Angles(-0.5 - 0.25 * COS(sine / 12), 0, -1), 0.15)
  333. LS.C0 = LS.C0:Lerp(LSnor * CFrame.new(0, 0, 0) * CFrame.Angles(-0.5 - 0.25 * COS(sine / 12), 0, 1), 0.15)
  334. RH.C0 = RH.C0:Lerp(RHnor * CFrame.new(0, 0, 0), 0.15)
  335. LH.C0 = LH.C0:Lerp(LHnor * CFrame.new(-0.5, 0.5 + 0.25 * COS(sine / 12), 0), 0.15)
  336. rootj.C0 = rootj.C0:Lerp(CFrame.new(0, -3 - 0.1 * COS(sine / 12), -0.5) * CFrame.Angles(1, 0, 0), 0.15)
  337. neck.C0 = neck.C0:Lerp(necknor * CFrame.new(0, 0, 0) * CFrame.Angles(-1, 0, 0), 0.15)
  338. elseif animpose == "Jumping" and normalanim then
  339. rootj.C0 = rootj.C0:Lerp(rootjnor * CFrame.Angles(-0.5, 0, 0), 0.15)
  340. RS.C0 = RS.C0:Lerp(RSnor * CFrame.Angles(-0.3, 0, 0), 0.15)
  341. LS.C0 = LS.C0:Lerp(LSnor * CFrame.Angles(-0.3, 0, 0), 0.15)
  342. RH.C0 = RH.C0:Lerp(RHnor, 0.15)
  343. LH.C0 = LH.C0:Lerp(LHnor, 0.15)
  344. elseif animpose == "Falling" and normalanim then
  345. rootj.C0 = rootj.C0:Lerp(rootjnor * CFrame.Angles(0.5, 0, 0), 0.15)
  346. RS.C0 = RS.C0:Lerp(RSnor * CFrame.Angles(-0.6, 0, 0), 0.15)
  347. LS.C0 = LS.C0:Lerp(LSnor * CFrame.Angles(-0.6, 0, 0), 0.15)
  348. RH.C0 = RH.C0:Lerp(RHnor, 0.15)
  349. LH.C0 = LH.C0:Lerp(LHnor, 0.15)
  350. end
  351. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement