EmirhanAsik

Saber Simulator [OUTDATED]

Oct 14th, 2019 (edited)
16,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.12 KB | None | 0 0
  1. print("Saber GUI Loading...")
  2. local library = {
  3. windowcount = 0;
  4. }
  5.  
  6. local dragger = {};
  7. local resizer = {};
  8.  
  9. do
  10. local mouse = game:GetService("Players").LocalPlayer:GetMouse();
  11. local inputService = game:GetService('UserInputService');
  12. local heartbeat = game:GetService("RunService").Heartbeat;
  13. -- // credits to Ririchi / Inori for this cute drag function :)
  14. function dragger.new(frame)
  15. local s, event = pcall(function()
  16. return frame.MouseEnter
  17. end)
  18.  
  19. if s then
  20. frame.Active = true;
  21.  
  22. event:connect(function()
  23. local input = frame.InputBegan:connect(function(key)
  24. if key.UserInputType == Enum.UserInputType.MouseButton1 then
  25. local objectPosition = Vector2.new(mouse.X - frame.AbsolutePosition.X, mouse.Y - frame.AbsolutePosition.Y);
  26. while heartbeat:wait() and inputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  27. 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);
  28. end
  29. end
  30. end)
  31.  
  32. local leave;
  33. leave = frame.MouseLeave:connect(function()
  34. input:disconnect();
  35. leave:disconnect();
  36. end)
  37. end)
  38. end
  39. end
  40.  
  41. function resizer.new(p, s)
  42. p:GetPropertyChangedSignal('AbsoluteSize'):connect(function()
  43. s.Size = UDim2.new(s.Size.X.Scale, s.Size.X.Offset, s.Size.Y.Scale, p.AbsoluteSize.Y);
  44. end)
  45. end
  46. end
  47.  
  48.  
  49. local defaults = {
  50. txtcolor = Color3.fromRGB(255, 255, 255),
  51. underline = Color3.fromRGB(0, 255, 140),
  52. barcolor = Color3.fromRGB(40, 40, 40),
  53. bgcolor = Color3.fromRGB(30, 30, 30),
  54. }
  55.  
  56. function library:Create(class, props)
  57. local object = Instance.new(class);
  58.  
  59. for i, prop in next, props do
  60. if i ~= "Parent" then
  61. object[i] = prop;
  62. end
  63. end
  64.  
  65. object.Parent = props.Parent;
  66. return object;
  67. end
  68.  
  69. function library:CreateWindow(options)
  70. assert(options.text, "no name");
  71. local window = {
  72. count = 0;
  73. toggles = {},
  74. closed = false;
  75. }
  76.  
  77. local options = options or {};
  78. setmetatable(options, {__index = defaults})
  79.  
  80. self.windowcount = self.windowcount + 1;
  81.  
  82. library.gui = library.gui or self:Create("ScreenGui", {Name = "UILibrary", Parent = game:GetService("CoreGui")})
  83. window.frame = self:Create("Frame", {
  84. Name = options.text;
  85. Parent = self.gui,
  86. Active = true,
  87. BackgroundTransparency = 0,
  88. Size = UDim2.new(0, 190, 0, 30),
  89. Position = UDim2.new(0, (15 + ((200 * self.windowcount) - 200)), 0, 15),
  90. BackgroundColor3 = options.barcolor,
  91. BorderSizePixel = 0;
  92. })
  93.  
  94. window.background = self:Create('Frame', {
  95. Name = 'Background';
  96. Parent = window.frame,
  97. BorderSizePixel = 0;
  98. BackgroundColor3 = options.bgcolor,
  99. Position = UDim2.new(0, 0, 1, 0),
  100. Size = UDim2.new(1, 0, 0, 25),
  101. ClipsDescendants = true;
  102. })
  103.  
  104. window.container = self:Create('Frame', {
  105. Name = 'Container';
  106. Parent = window.frame,
  107. BorderSizePixel = 0;
  108. BackgroundColor3 = options.bgcolor,
  109. Position = UDim2.new(0, 0, 1, 0),
  110. Size = UDim2.new(1, 0, 0, 25),
  111. ClipsDescendants = true;
  112. })
  113.  
  114. window.organizer = self:Create('UIListLayout', {
  115. Name = 'Sorter';
  116. --Padding = UDim.new(0, 0);
  117. SortOrder = Enum.SortOrder.LayoutOrder;
  118. Parent = window.container;
  119. })
  120.  
  121. window.padder = self:Create('UIPadding', {
  122. Name = 'Padding';
  123. PaddingLeft = UDim.new(0, 10);
  124. PaddingTop = UDim.new(0, 5);
  125. Parent = window.container;
  126. })
  127.  
  128. self:Create("Frame", {
  129. Name = 'Underline';
  130. Size = UDim2.new(1, 0, 0, 1),
  131. Position = UDim2.new(0, 0, 1, -1),
  132. BorderSizePixel = 0;
  133. BackgroundColor3 = options.underline;
  134. Parent = window.frame
  135. })
  136.  
  137. local togglebutton = self:Create("TextButton", {
  138. Name = 'Toggle';
  139. ZIndex = 2,
  140. BackgroundTransparency = 1;
  141. Position = UDim2.new(1, -25, 0, 0),
  142. Size = UDim2.new(0, 25, 1, 0),
  143. Text = "-",
  144. TextSize = 17,
  145. TextColor3 = options.txtcolor,
  146. Font = Enum.Font.SourceSans;
  147. Parent = window.frame,
  148. });
  149.  
  150. togglebutton.MouseButton1Click:connect(function()
  151. window.closed = not window.closed
  152. togglebutton.Text = (window.closed and "+" or "-")
  153. if window.closed then
  154. window:Resize(true, UDim2.new(1, 0, 0, 0))
  155. else
  156. window:Resize(true)
  157. end
  158. end)
  159.  
  160. self:Create("TextLabel", {
  161. Size = UDim2.new(1, 0, 1, 0),
  162. BackgroundTransparency = 1;
  163. BorderSizePixel = 0;
  164. TextColor3 = options.txtcolor,
  165. TextColor3 = (options.bartextcolor or Color3.fromRGB(255, 255, 255));
  166. TextSize = 17,
  167. Font = Enum.Font.SourceSansSemibold;
  168. Text = options.text or "window",
  169. Name = "Window",
  170. Parent = window.frame,
  171. })
  172.  
  173. do
  174. dragger.new(window.frame)
  175. resizer.new(window.background, window.container);
  176. end
  177.  
  178. local function getSize()
  179. local ySize = 0;
  180. for i, object in next, window.container:GetChildren() do
  181. if (not object:IsA('UIListLayout')) and (not object:IsA('UIPadding')) then
  182. ySize = ySize + object.AbsoluteSize.Y
  183. end
  184. end
  185. return UDim2.new(1, 0, 0, ySize + 10)
  186. end
  187.  
  188. function window:Resize(tween, change)
  189. local size = change or getSize()
  190. self.container.ClipsDescendants = true;
  191.  
  192. if tween then
  193. self.background:TweenSize(size, "Out", "Sine", 0.5, true)
  194. else
  195. self.background.Size = size
  196. end
  197. end
  198.  
  199. function window:AddToggle(text, callback)
  200. self.count = self.count + 1
  201.  
  202. callback = callback or function() end
  203. local label = library:Create("TextLabel", {
  204. Text = text,
  205. Size = UDim2.new(1, -10, 0, 20);
  206. --Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
  207. BackgroundTransparency = 1;
  208. TextColor3 = Color3.fromRGB(255, 255, 255);
  209. TextXAlignment = Enum.TextXAlignment.Left;
  210. LayoutOrder = self.Count;
  211. TextSize = 16,
  212. Font = Enum.Font.SourceSans,
  213. Parent = self.container;
  214. })
  215.  
  216. local button = library:Create("TextButton", {
  217. Text = "OFF",
  218. TextColor3 = Color3.fromRGB(255, 25, 25),
  219. BackgroundTransparency = 1;
  220. Position = UDim2.new(1, -25, 0, 0),
  221. Size = UDim2.new(0, 25, 1, 0),
  222. TextSize = 17,
  223. Font = Enum.Font.SourceSansSemibold,
  224. Parent = label;
  225. })
  226.  
  227. button.MouseButton1Click:connect(function()
  228. self.toggles[text] = (not self.toggles[text])
  229. button.TextColor3 = (self.toggles[text] and Color3.fromRGB(0, 255, 140) or Color3.fromRGB(255, 25, 25))
  230. button.Text =(self.toggles[text] and "ON" or "OFF")
  231.  
  232. callback(self.toggles[text])
  233. end)
  234.  
  235. self:Resize()
  236. return button
  237. end
  238.  
  239. function window:AddBox(text, callback)
  240. self.count = self.count + 1
  241. callback = callback or function() end
  242.  
  243. local box = library:Create("TextBox", {
  244. PlaceholderText = text,
  245. Size = UDim2.new(1, -10, 0, 20);
  246. --Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
  247. BackgroundTransparency = 0.75;
  248. BackgroundColor3 = options.boxcolor,
  249. TextColor3 = Color3.fromRGB(255, 255, 255);
  250. TextXAlignment = Enum.TextXAlignment.Center;
  251. TextSize = 16,
  252. Text = "",
  253. Font = Enum.Font.SourceSans,
  254. LayoutOrder = self.Count;
  255. BorderSizePixel = 0;
  256. Parent = self.container;
  257. })
  258.  
  259. box.FocusLost:connect(function(...)
  260. callback(box, ...)
  261. end)
  262.  
  263. self:Resize()
  264. return box
  265. end
  266.  
  267. function window:AddButton(text, callback)
  268. self.count = self.count + 1
  269.  
  270. callback = callback or function() end
  271. local button = library:Create("TextButton", {
  272. Text = text,
  273. Size = UDim2.new(1, -10, 0, 20);
  274. --Position = UDim2.new(0, 5, 0, ((20 * self.count) - 20) + 5),
  275. BackgroundTransparency = 1;
  276. TextColor3 = Color3.fromRGB(255, 255, 255);
  277. TextXAlignment = Enum.TextXAlignment.Left;
  278. TextSize = 16,
  279. Font = Enum.Font.SourceSans,
  280. LayoutOrder = self.Count;
  281. Parent = self.container;
  282. })
  283.  
  284. button.MouseButton1Click:connect(callback)
  285. self:Resize()
  286. return button
  287. end
  288.  
  289. function window:AddLabel(text)
  290. self.count = self.count + 1;
  291.  
  292. local tSize = game:GetService('TextService'):GetTextSize(text, 16, Enum.Font.SourceSans, Vector2.new(math.huge, math.huge))
  293.  
  294. local button = library:Create("TextLabel", {
  295. Text = text,
  296. Size = UDim2.new(1, -10, 0, tSize.Y + 5);
  297. TextScaled = false;
  298. BackgroundTransparency = 1;
  299. TextColor3 = Color3.fromRGB(255, 255, 255);
  300. TextXAlignment = Enum.TextXAlignment.Left;
  301. TextSize = 16,
  302. Font = Enum.Font.SourceSans,
  303. LayoutOrder = self.Count;
  304. Parent = self.container;
  305. })
  306.  
  307. self:Resize()
  308. return button
  309. end
  310.  
  311. function window:AddDropdown(options, callback)
  312. self.count = self.count + 1
  313. local default = options[1] or "";
  314.  
  315. callback = callback or function() end
  316. local dropdown = library:Create("TextLabel", {
  317. Size = UDim2.new(1, -10, 0, 20);
  318. BackgroundTransparency = 0.75;
  319. BackgroundColor3 = options.boxcolor,
  320. TextColor3 = Color3.fromRGB(255, 255, 255);
  321. TextXAlignment = Enum.TextXAlignment.Center;
  322. TextSize = 16,
  323. Text = default,
  324. Font = Enum.Font.SourceSans,
  325. BorderSizePixel = 0;
  326. LayoutOrder = self.Count;
  327. Parent = self.container;
  328. })
  329.  
  330. local button = library:Create("ImageButton",{
  331. BackgroundTransparency = 1;
  332. Image = 'rbxassetid://3234893186';
  333. Size = UDim2.new(0, 18, 1, 0);
  334. Position = UDim2.new(1, -20, 0, 0);
  335. Parent = dropdown;
  336. })
  337.  
  338. local frame;
  339.  
  340. local function isInGui(frame)
  341. local mloc = game:GetService('UserInputService'):GetMouseLocation();
  342. local mouse = Vector2.new(mloc.X, mloc.Y - 36);
  343.  
  344. local x1, x2 = frame.AbsolutePosition.X, frame.AbsolutePosition.X + frame.AbsoluteSize.X;
  345. local y1, y2 = frame.AbsolutePosition.Y, frame.AbsolutePosition.Y + frame.AbsoluteSize.Y;
  346.  
  347. return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
  348. end
  349.  
  350. local function count(t)
  351. local c = 0;
  352. for i, v in next, t do
  353. c = c + 1
  354. end
  355. return c;
  356. end
  357.  
  358. button.MouseButton1Click:connect(function()
  359. if count(options) == 0 then
  360. return
  361. end
  362.  
  363. if frame then
  364. frame:Destroy();
  365. frame = nil;
  366. end
  367.  
  368. self.container.ClipsDescendants = false;
  369.  
  370. frame = library:Create('Frame', {
  371. Position = UDim2.new(0, 0, 1, 0);
  372. BackgroundColor3 = Color3.fromRGB(40, 40, 40);
  373. Size = UDim2.new(0, dropdown.AbsoluteSize.X, 0, (count(options) * 21));
  374. BorderSizePixel = 0;
  375. Parent = dropdown;
  376. ClipsDescendants = true;
  377. ZIndex = 2;
  378. })
  379.  
  380. library:Create('UIListLayout', {
  381. Name = 'Layout';
  382. Parent = frame;
  383. })
  384.  
  385. for i, option in next, options do
  386. local selection = library:Create('TextButton', {
  387. Text = option;
  388. BackgroundColor3 = Color3.fromRGB(40, 40, 40);
  389. TextColor3 = Color3.fromRGB(255, 255, 255);
  390. BorderSizePixel = 0;
  391. TextSize = 16;
  392. Font = Enum.Font.SourceSans;
  393. Size = UDim2.new(1, 0, 0, 21);
  394. Parent = frame;
  395. ZIndex = 2;
  396. })
  397.  
  398. selection.MouseButton1Click:connect(function()
  399. dropdown.Text = option;
  400. callback(option)
  401. frame.Size = UDim2.new(1, 0, 0, 0);
  402. game:GetService('Debris'):AddItem(frame, 0.1)
  403. end)
  404. end
  405. end);
  406.  
  407. game:GetService('UserInputService').InputBegan:connect(function(m)
  408. if m.UserInputType == Enum.UserInputType.MouseButton1 then
  409. if frame and (not isInGui(frame)) then
  410. game:GetService('Debris'):AddItem(frame);
  411. end
  412. end
  413. end)
  414.  
  415. callback(default);
  416. self:Resize()
  417. return {
  418. Refresh = function(self, array)
  419. game:GetService('Debris'):AddItem(frame);
  420. options = array
  421. dropdown.Text = options[1];
  422. end
  423. }
  424. end;
  425.  
  426.  
  427. return window
  428. end
  429. local afkGui = library:CreateWindow({
  430. text = "AutoFarm"
  431. })
  432. local localplayer = library:CreateWindow({
  433. text = "LocalPlayer"
  434. })
  435. local teleport = library:CreateWindow({
  436. text = "Teleports"
  437. })
  438. local credits = library:CreateWindow({
  439. text = "Credits"
  440. })
  441. afkGui:AddToggle("AutoFarm Candy", function(state)
  442. if state then
  443. local plr = game.Players.LocalPlayer.Character
  444. while true do
  445. wait()
  446. plr.HumanoidRootPart.CFrame = CFrame.new(workspace.CandyHolder:FindFirstChild("Candy").CFrame.Position)
  447. wait(0)
  448. workspace.CandyHolder:FindFirstChild("Candy"):Destroy()
  449. end
  450. else
  451. waitValue5 = 100000000000000000000000
  452. end
  453. end)
  454.  
  455. afkGui:AddToggle("AutoFarm Coins", function(state)
  456. if state then
  457. waitValue4 = .1
  458. while wait(waitValue4) do
  459. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.CoinsHolder.Coin.CFrame
  460. end
  461. else
  462. waitValue4 = 100000000000000000000000
  463. end
  464. end)
  465.  
  466. localplayer:AddToggle("High Jump", function(state)
  467. game:GetService("Players").LocalPlayer.Character.Humanoid.JumpPower = (state and 100 or 50)
  468. end)
  469.  
  470. afkGui:AddToggle("AutoFarm Strength", function(state)
  471. if state then
  472. waitValue = .2
  473. while wait(waitValue) do
  474. game.ReplicatedStorage.Events.Clicked:FireServer()
  475. end
  476. else
  477. waitValue = 100000000000000000000
  478. end
  479. end)
  480. afkGui:AddToggle("Auto Sell when Full", function(state)
  481. if state then
  482. waitValue2 = .1
  483. while wait(waitValue2) do
  484. if game.Players.LocalPlayer.PlayerGui.Gui.Submenus.BackpackFull.Visible == true then
  485. lastCF = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
  486. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.Locations.Sell.CFrame
  487. wait(.7)
  488. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = lastCF
  489. end
  490. end
  491. else
  492. waitValue2 = 10000000000000000000
  493. end
  494. end)
  495. afkGui:AddLabel("Click screen when bag full")
  496.  
  497. afkGui:AddToggle("AutoHatch(Pumpkin)", function(state)
  498. if state then
  499. waitValue3 = .1
  500. while wait(waitValue3) do
  501. game.ReplicatedStorage.Events.HatchEggs:InvokeServer(game.ReplicatedStorage.Eggs.Pumpkin, 1)
  502. end
  503. else
  504. waitValue3 = 100000000000000
  505. end
  506. end)
  507. afkGui:AddToggle("AutoHatch(BasicEgg)", function(state)
  508. if state then
  509. waitValue8 = .1
  510. while wait(waitValue8) do
  511. game.ReplicatedStorage.Events.HatchEggs:InvokeServer(game.ReplicatedStorage.Eggs["Basic Egg"], 1)
  512. end
  513. else
  514. waitValue8 = 100000000000000
  515. end
  516. end)
  517. afkGui:AddToggle("AutoHatch(WoodenEgg)", function(state)
  518. if state then
  519. waitValue7 = .1
  520. while wait(waitValue7) do
  521. game.ReplicatedStorage.Events.HatchEggs:InvokeServer(game.ReplicatedStorage.Eggs["Wooden Egg"], 1)
  522. end
  523. else
  524. waitValue7 = 100000000000000
  525. end
  526. end)
  527. afkGui:AddToggle("AutoBuy Swords", function(state)
  528.  
  529. if state then
  530. waitValue7 = .1
  531. while wait(waitValue7) do
  532. game.ReplicatedStorage.Events.BuyAll:FireServer("Swords")
  533. end
  534. else
  535. waitValue7 = 100000000000000
  536. end
  537.  
  538. end)
  539. afkGui:AddToggle("AutoBuy DNA", function(state)
  540.  
  541. if state then
  542. waitValue7 = .1
  543. while wait(waitValue7) do
  544. game.ReplicatedStorage.Events.BuyAll:FireServer("Backpacks")
  545. end
  546. else
  547. waitValue7 = 100000000000000
  548. end
  549.  
  550.  
  551. end)
  552. teleport:AddButton("Teleport To All Players", function()
  553. local players = game.Players:GetChildren()
  554. for i, player in ipairs(players) do
  555. wait(.5)
  556. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Players[player.Name].Character.HumanoidRootPart.CFrame
  557. end
  558. end)
  559. teleport:AddButton("Sell", function()
  560. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.Locations.Sell.CFrame
  561. end)
  562. teleport:AddButton("Shop", function()
  563. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.Locations.Shop.CFrame
  564. end)
  565. teleport:AddButton("Spawn", function()
  566. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.Locations.FirstSpawns.FirstSpawn.CFrame
  567. end)
  568. teleport:AddButton("Crown Shop", function()
  569. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.Locations.CrownShop.CFrame
  570. end)
  571. teleport:AddButton("King of The Hill", function()
  572. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.Locations.KingArea.CFrame
  573. end)
  574. teleport:AddButton("Arena", function()
  575. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.Locations.ArenaBase.CFrame
  576. end)
  577. teleport:AddBox("Goto Player:", function(object, focus)
  578. if focus then
  579. game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = game.Players[object.Text].Character.HumanoidRootPart.CFrame
  580. end
  581. end)
  582. credits:AddLabel("GUI made by EmirhanAsik")
  583. credits:AddLabel("Script made by EmirhanAsik")
  584. print("Saber GUI loaded")
Add Comment
Please, Sign In to add comment