Advertisement
XxMarioEspinal749xX

Race

May 1st, 2022
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.29 KB | None | 0 0
  1. local vu = game:GetService("VirtualUser")
  2. game:GetService("Players").LocalPlayer.Idled:connect(function()
  3. vu:Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  4. wait(1)
  5. vu:Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  6. end)
  7.  
  8. local library = {
  9. windowcount = 0;
  10. }
  11.  
  12. local dragger = {};
  13. local resizer = {};
  14.  
  15. do
  16. local mouse = game:GetService("Players").LocalPlayer:GetMouse();
  17. local inputService = game:GetService('UserInputService');
  18. local heartbeat = game:GetService("RunService").Heartbeat;
  19. -- // credits to Ririchi / Inori for this cute drag function :)
  20. function dragger.new(frame)
  21. local s, event = pcall(function()
  22. return frame.MouseEnter
  23. end)
  24.  
  25. if s then
  26. frame.Active = true;
  27.  
  28. event:connect(function()
  29. local input = frame.InputBegan:connect(function(key)
  30. if key.UserInputType == Enum.UserInputType.MouseButton1 then
  31. local objectPosition = Vector2.new(mouse.X - frame.AbsolutePosition.X, mouse.Y - frame.AbsolutePosition.Y);
  32. while heartbeat:wait() and inputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  33. frame:TweenPosition(UDim2.new(0, mouse.X - objectPosition.X + (frame.Size.X.Offset * frame.AnchorPoint.X), 0, mouse.Y - objectPosition.Y + (frame.Size.Y.Offset * frame.AnchorPoint.Y)), 'Out', 'Quad', 0.1, true);
  34. end
  35. end
  36. end)
  37.  
  38. local leave;
  39. leave = frame.MouseLeave:connect(function()
  40. input:disconnect();
  41. leave:disconnect();
  42. end)
  43. end)
  44. end
  45. end
  46.  
  47. function resizer.new(p, s)
  48. p:GetPropertyChangedSignal('AbsoluteSize'):connect(function()
  49. s.Size = UDim2.new(s.Size.X.Scale, s.Size.X.Offset, s.Size.Y.Scale, p.AbsoluteSize.Y);
  50. end)
  51. end
  52. end
  53.  
  54.  
  55. local defaults = {
  56. txtcolor = Color3.fromRGB(255, 255, 255),
  57. underline = Color3.fromRGB(0, 255, 140),
  58. barcolor = Color3.fromRGB(40, 40, 40),
  59. bgcolor = Color3.fromRGB(30, 30, 30),
  60. }
  61.  
  62. function library:Create(class, props)
  63. local object = Instance.new(class);
  64.  
  65. for i, prop in next, props do
  66. if i ~= "Parent" then
  67. object[i] = prop;
  68. end
  69. end
  70.  
  71. object.Parent = props.Parent;
  72. return object;
  73. end
  74.  
  75. function library:CreateWindow(options)
  76. assert(options.text, "no name");
  77. local window = {
  78. count = 0;
  79. toggles = {},
  80. closed = false;
  81. }
  82.  
  83. local options = options or {};
  84. setmetatable(options, {__index = defaults})
  85.  
  86. self.windowcount = self.windowcount + 1;
  87.  
  88. library.gui = library.gui or self:Create("ScreenGui", {Name = "UILibrary", Parent = game:GetService("CoreGui")})
  89. window.frame = self:Create("Frame", {
  90. Name = options.text;
  91. Parent = self.gui,
  92. Active = true,
  93. BackgroundTransparency = 0,
  94. Size = UDim2.new(0, 190, 0, 30),
  95. Position = UDim2.new(0, (15 + ((200 * self.windowcount) - 200)), 0, 15),
  96. BackgroundColor3 = options.barcolor,
  97. BorderSizePixel = 0;
  98. })
  99.  
  100. window.background = self:Create('Frame', {
  101. Name = 'Background';
  102. Parent = window.frame,
  103. BorderSizePixel = 0;
  104. BackgroundColor3 = options.bgcolor,
  105. Position = UDim2.new(0, 0, 1, 0),
  106. Size = UDim2.new(1, 0, 0, 25),
  107. ClipsDescendants = true;
  108. })
  109.  
  110. window.container = self:Create('Frame', {
  111. Name = 'Container';
  112. Parent = window.frame,
  113. BorderSizePixel = 0;
  114. BackgroundColor3 = options.bgcolor,
  115. Position = UDim2.new(0, 0, 1, 0),
  116. Size = UDim2.new(1, 0, 0.3, 0),
  117. ClipsDescendants = true;
  118. })
  119.  
  120. window.organizer = self:Create('UIListLayout', {
  121. Name = 'Sorter';
  122. Padding = UDim.new(0, 1);
  123. SortOrder = Enum.SortOrder.LayoutOrder;
  124. Parent = window.container;
  125. })
  126.  
  127. window.padder = self:Create('UIPadding', {
  128. Name = 'Padding';
  129. PaddingLeft = UDim.new(0, 10);
  130. PaddingTop = UDim.new(0, 5);
  131. Parent = window.container;
  132. })
  133.  
  134. self:Create("Frame", {
  135. Name = 'Underline';
  136. Size = UDim2.new(1, 0, 0, 1),
  137. Position = UDim2.new(0, 0, 1, -1),
  138. BorderSizePixel = 0;
  139. BackgroundColor3 = options.underline;
  140. Parent = window.frame
  141. })
  142.  
  143. local togglebutton = self:Create("TextButton", {
  144. Name = 'Toggle';
  145. ZIndex = 2,
  146. BackgroundTransparency = 1;
  147. Position = UDim2.new(1, -25, 0, 0),
  148. Size = UDim2.new(0, 25, 1, 0),
  149. Text = "-",
  150. TextSize = 17,
  151. TextColor3 = options.txtcolor,
  152. Font = Enum.Font.SourceSans;
  153. Parent = window.frame,
  154. });
  155.  
  156. togglebutton.MouseButton1Click:connect(function()
  157. window.closed = not window.closed
  158. togglebutton.Text = (window.closed and "+" or "-")
  159. if window.closed then
  160. window:Resize(true, UDim2.new(1, 0, 0, 0))
  161. else
  162. window:Resize(true)
  163. end
  164. end)
  165.  
  166. self:Create("TextLabel", {
  167. Size = UDim2.new(1, 0, 1, 0),
  168. BackgroundTransparency = 1;
  169. BorderSizePixel = 0;
  170. TextColor3 = options.txtcolor,
  171. TextColor3 = (options.bartextcolor or Color3.fromRGB(255, 255, 255));
  172. TextSize = 17,
  173. Font = Enum.Font.SourceSansSemibold;
  174. Text = options.text or "window",
  175. Name = "Window",
  176. Parent = window.frame,
  177. })
  178.  
  179. do
  180. dragger.new(window.frame)
  181. resizer.new(window.background, window.container);
  182. end
  183.  
  184. local function getSize()
  185. local ySize = 0;
  186. for i, object in next, window.container:GetChildren() do
  187. if (not object:IsA('UIListLayout')) and (not object:IsA('UIPadding')) then
  188. ySize = ySize + object.AbsoluteSize.Y
  189. end
  190. end
  191. return UDim2.new(1, 0, 0, ySize + 10)
  192. end
  193.  
  194. function window:Resize(tween, change)
  195. local size = change or getSize()
  196. self.container.ClipsDescendants = true;
  197.  
  198. if tween then
  199. self.background:TweenSize(size, "Out", "Sine", 0.5, true)
  200. else
  201. self.background.Size = size
  202. end
  203. end
  204.  
  205. function window:AddToggle(text, callback)
  206. self.count = self.count + 1
  207.  
  208. callback = callback or function() end
  209. local label = library:Create("TextLabel", {
  210. Text = text,
  211. Size = UDim2.new(1, -10, 0, 20);
  212. --Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
  213. BackgroundTransparency = 1;
  214. TextColor3 = Color3.fromRGB(255, 255, 255);
  215. TextXAlignment = Enum.TextXAlignment.Left;
  216. LayoutOrder = self.Count;
  217. TextSize = 16,
  218. Font = Enum.Font.SourceSans,
  219. Parent = self.container;
  220. })
  221.  
  222. local button = library:Create("TextButton", {
  223. Text = "OFF",
  224. TextColor3 = Color3.fromRGB(255, 25, 25),
  225. BackgroundTransparency = 1;
  226. Position = UDim2.new(1, -25, 0, 0),
  227. Size = UDim2.new(0, 25, 1, 0),
  228. TextSize = 17,
  229. Font = Enum.Font.SourceSansSemibold,
  230. Parent = label;
  231. })
  232.  
  233. button.MouseButton1Click:connect(function()
  234. self.toggles[text] = (not self.toggles[text])
  235. button.TextColor3 = (self.toggles[text] and Color3.fromRGB(0, 255, 140) or Color3.fromRGB(255, 25, 25))
  236. button.Text =(self.toggles[text] and "ON" or "OFF")
  237.  
  238. callback(self.toggles[text])
  239. end)
  240.  
  241. self:Resize()
  242. return button
  243. end
  244.  
  245. function window:AddBox(text, callback)
  246. self.count = self.count + 1
  247. callback = callback or function() end
  248.  
  249. local box = library:Create("TextBox", {
  250. PlaceholderText = text,
  251. Size = UDim2.new(1, -10, 0, 20);
  252. --Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
  253. BackgroundTransparency = 0.75;
  254. BackgroundColor3 = options.boxcolor,
  255. TextColor3 = Color3.fromRGB(255, 255, 255);
  256. TextXAlignment = Enum.TextXAlignment.Center;
  257. TextSize = 16,
  258. Text = "",
  259. Font = Enum.Font.SourceSans,
  260. LayoutOrder = self.Count;
  261. BorderSizePixel = 0;
  262. Parent = self.container;
  263. })
  264.  
  265. box.FocusLost:connect(function(...)
  266. callback(box, ...)
  267. end)
  268.  
  269. self:Resize()
  270. return box
  271. end
  272.  
  273. function window:AddDestroy(text, callback)
  274. self.count = self.count + 1
  275.  
  276. callback = callback or function() end
  277. local button = library:Create("TextButton", {
  278. Text = text,
  279. Size = UDim2.new(1, -10, 0, 20);
  280. --Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
  281. BackgroundTransparency = 0;
  282. BackgroundColor3 = Color3.fromRGB(50,50,50);
  283. BorderColor3 = Color3.fromRGB(150,150,150);
  284. TextColor3 = Color3.fromRGB(255, 255, 255);
  285. TextXAlignment = Enum.TextXAlignment.Center;
  286. TextSize = 16,
  287. Font = Enum.Font.SourceSans,
  288. LayoutOrder = self.Count;
  289. Parent = self.container;
  290. })
  291.  
  292. button.MouseButton1Click:connect(callback)
  293. self:Resize()
  294. return button
  295. end
  296.  
  297. function window:AddButton(text, callback)
  298. self.count = self.count + 1
  299.  
  300. callback = callback or function() end
  301. local button = library:Create("TextButton", {
  302. Text = text,
  303. Size = UDim2.new(1, -10, 0, 20);
  304. --Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
  305. BackgroundTransparency = 0;
  306. BackgroundColor3 = Color3.fromRGB(65,65,65);
  307. BorderColor3 = Color3.fromRGB(150,150,150);
  308. BorderSizePixel = 0;
  309. TextColor3 = Color3.fromRGB(255, 255, 255);
  310. TextXAlignment = Enum.TextXAlignment.Center;
  311. TextSize = 16,
  312. Font = Enum.Font.SourceSans,
  313. LayoutOrder = self.Count;
  314. Parent = self.container;
  315. })
  316.  
  317. button.MouseButton1Click:connect(callback)
  318. self:Resize()
  319. return button
  320. end
  321.  
  322. function window:AddLabel(text)
  323. self.count = self.count + 1;
  324.  
  325. local tSize = game:GetService('TextService'):GetTextSize(text, 16, Enum.Font.SourceSans, Vector2.new(math.huge, math.huge))
  326.  
  327. local button = library:Create("TextLabel", {
  328. Text = text,
  329. Size = UDim2.new(1, -10, 0, tSize.Y + 5);
  330. TextScaled = false;
  331. BackgroundTransparency = 1;
  332. TextColor3 = Color3.fromRGB(255, 255, 255);
  333. TextXAlignment = Enum.TextXAlignment.Left;
  334. TextSize = 16,
  335. Font = Enum.Font.SourceSans,
  336. LayoutOrder = self.Count;
  337. Parent = self.container;
  338. })
  339.  
  340. self:Resize()
  341. return button
  342. end
  343.  
  344. function window:AddDropdown(options, callback)
  345. self.count = self.count + 1
  346. local default = options[1] or "";
  347.  
  348. callback = callback or function() end
  349. local dropdown = library:Create("TextLabel", {
  350. Size = UDim2.new(1, -10, 0, 20);
  351. BackgroundTransparency = 0.75;
  352. BackgroundColor3 = options.boxcolor,
  353. TextColor3 = Color3.fromRGB(255, 255, 255);
  354. TextXAlignment = Enum.TextXAlignment.Center;
  355. TextSize = 16,
  356. Text = default,
  357. Font = Enum.Font.SourceSans,
  358. BorderSizePixel = 0;
  359. LayoutOrder = self.Count;
  360. Parent = self.container;
  361. })
  362.  
  363. local button = library:Create("ImageButton",{
  364. BackgroundTransparency = 1;
  365. Image = 'rbxassetid://3234893186';
  366. Size = UDim2.new(0, 18, 1, 0);
  367. Position = UDim2.new(1, -20, 0, 0);
  368. Parent = dropdown;
  369. })
  370.  
  371. local frame;
  372.  
  373. local function isInGui(frame)
  374. local mloc = game:GetService('UserInputService'):GetMouseLocation();
  375. local mouse = Vector2.new(mloc.X, mloc.Y - 36);
  376.  
  377. local x1, x2 = frame.AbsolutePosition.X, frame.AbsolutePosition.X + frame.AbsoluteSize.X;
  378. local y1, y2 = frame.AbsolutePosition.Y, frame.AbsolutePosition.Y + frame.AbsoluteSize.Y;
  379.  
  380. return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
  381. end
  382.  
  383. local function count(t)
  384. local c = 0;
  385. for i, v in next, t do
  386. c = c + 1
  387. end
  388. return c;
  389. end
  390.  
  391. button.MouseButton1Click:connect(function()
  392. if count(options) == 0 then
  393. return
  394. end
  395.  
  396. if frame then
  397. frame:Destroy();
  398. frame = nil;
  399. end
  400.  
  401. self.container.ClipsDescendants = false;
  402.  
  403. frame = library:Create('Frame', {
  404. Position = UDim2.new(0, 0, 1, 0);
  405. BackgroundColor3 = Color3.fromRGB(40, 40, 40);
  406. Size = UDim2.new(0, dropdown.AbsoluteSize.X, 0, (count(options) * 21));
  407. BorderSizePixel = 0;
  408. Parent = dropdown;
  409. ClipsDescendants = true;
  410. ZIndex = 2;
  411. })
  412.  
  413. library:Create('UIListLayout', {
  414. Name = 'Layout';
  415. Parent = frame;
  416. })
  417.  
  418. for i, option in next, options do
  419. local selection = library:Create('TextButton', {
  420. Text = option;
  421. BackgroundColor3 = Color3.fromRGB(40, 40, 40);
  422. TextColor3 = Color3.fromRGB(255, 255, 255);
  423. BorderSizePixel = 0;
  424. TextSize = 16;
  425. Font = Enum.Font.SourceSans;
  426. Size = UDim2.new(1, 0, 0, 21);
  427. Parent = frame;
  428. ZIndex = 2;
  429. })
  430.  
  431. selection.MouseButton1Click:connect(function()
  432. dropdown.Text = option;
  433. callback(option)
  434. frame.Size = UDim2.new(1, 0, 0, 0);
  435. game:GetService('Debris'):AddItem(frame, 0.1)
  436. end)
  437. end
  438. end);
  439.  
  440. game:GetService('UserInputService').InputBegan:connect(function(m)
  441. if m.UserInputType == Enum.UserInputType.MouseButton1 then
  442. if frame and (not isInGui(frame)) then
  443. game:GetService('Debris'):AddItem(frame);
  444. end
  445. end
  446. end)
  447.  
  448. callback(default);
  449. self:Resize()
  450. return {
  451. Refresh = function(self, array)
  452. game:GetService('Debris'):AddItem(frame);
  453. options = array
  454. dropdown.Text = options[1];
  455. end
  456. }
  457. end;
  458.  
  459.  
  460. return window
  461. end
  462.  
  463. local example = library:CreateWindow({
  464. text = "Auto Race Complete"
  465. })
  466.  
  467.  
  468.  
  469.  
  470. local credits= library:CreateWindow({text='Créditos a'})
  471. credits:AddLabel("[ME749] Legends Of Speed")
  472.  
  473. example:AddToggle("Activate/Deactivate",function(state)
  474. _G.Farm = (state and true or false)
  475. wait()
  476. while _G.Farm == true do
  477. wait(0.6)
  478. game:GetService("ReplicatedStorage").rEvents.raceEvent:FireServer("joinRace", true)
  479. wait()
  480. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(48.311, 36.315, -8680.453)
  481. wait ()
  482. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(1686.075, 36.315, -5946.634)
  483. wait()
  484. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(1001.331, 36.315, -10986.218)
  485.  
  486. end
  487. end)
  488.  
  489. example:AddDestroy("Exit",function()
  490. library.gui:Destroy()
  491. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement