RXYSETTINGS

Coordinate Saver

Dec 4th, 2025 (edited)
10,064
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.76 KB | Source Code | 0 0
  1. -- Simple Coordinate Saver (Executor Version)
  2. -- By Kitoo
  3.  
  4. local HttpService = game:GetService("HttpService")
  5. local Players = game:GetService("Players")
  6. local LocalPlayer = Players.LocalPlayer
  7.  
  8. -- Folder & file
  9. local FOLDER = ".Cordinat"
  10. local FILE = FOLDER .. "/kito.json"
  11.  
  12. -- Cek dukungan executor
  13. local canWrite = (type(writefile) == "function" and type(readfile) == "function")
  14. local canFS = (type(isfile) == "function" and type(isfolder) == "function" and type(makefolder) == "function")
  15.  
  16. -- Buat folder jika belum ada
  17. if canFS and not isfolder(FOLDER) then
  18.     pcall(makefolder, FOLDER)
  19. end
  20.  
  21. -- Fungsi load data
  22. local function loadCoords()
  23.     if not canWrite then return {} end
  24.     if canFS and isfile(FILE) then
  25.         local ok, data = pcall(readfile, FILE)
  26.         if ok and data and #data > 0 then
  27.             local success, tbl = pcall(function() return HttpService:JSONDecode(data) end)
  28.             if success and type(tbl) == "table" then
  29.                 return tbl
  30.             end
  31.         end
  32.     end
  33.     return {}
  34. end
  35.  
  36. -- Fungsi save data
  37. local function saveCoords(tbl)
  38.     if not canWrite then return false end
  39.     local ok, json = pcall(function() return HttpService:JSONEncode(tbl) end)
  40.     if ok then
  41.         pcall(writefile, FILE, json)
  42.         return true
  43.     end
  44.     return false
  45. end
  46.  
  47. -- Ambil posisi pemain
  48. local function getPos()
  49.     local char = LocalPlayer.Character
  50.     if not char then return nil end
  51.     local hrp = char:FindFirstChild("HumanoidRootPart")
  52.     if not hrp then return nil end
  53.     return hrp.Position
  54. end
  55.  
  56. -- Tambah koordinat
  57. local function addCoord(name)
  58.     local pos = getPos()
  59.     if not pos then warn("Karakter tidak ditemukan.") return end
  60.     local coords = loadCoords()
  61.     name = tostring(name or ("Pos_" .. math.random(1000,9999)))
  62.     coords[name] = {pos.X, pos.Y, pos.Z}
  63.     saveCoords(coords)
  64.     print("[+] Disimpan:", name)
  65. end
  66.  
  67. -- Teleport
  68. local function tpCoord(name)
  69.     local coords = loadCoords()
  70.     local t = coords[name]
  71.     if not t then warn("Koordinat tidak ditemukan:", name) return end
  72.     local char = LocalPlayer.Character
  73.     if not char then return end
  74.     local hrp = char:FindFirstChild("HumanoidRootPart")
  75.     if hrp then
  76.         hrp.CFrame = CFrame.new(t[1], t[2], t[3])
  77.         print("[✔] Teleport ke:", name)
  78.     end
  79. end
  80.  
  81. -- Hapus koordinat
  82. local function delCoord(name)
  83.     local coords = loadCoords()
  84.     if coords[name] then
  85.         coords[name] = nil
  86.         saveCoords(coords)
  87.         print("[-] Hapus:", name)
  88.     else
  89.         warn("Nama tidak ditemukan:", name)
  90.     end
  91. end
  92.  
  93. -- List koordinat
  94. local function listCoords()
  95.     local coords = loadCoords()
  96.     for n,v in pairs(coords) do
  97.         print(string.format("%s -> (%.2f, %.2f, %.2f)", n, v[1], v[2], v[3]))
  98.     end
  99.     if next(coords) == nil then
  100.         print("(kosong)")
  101.     end
  102. end
  103.  
  104. -- ========= UI SEDERHANA + DRAGGABLE ==========
  105. local gui = Instance.new("ScreenGui")
  106. gui.Name = "CoordsSaverUI"
  107. gui.ResetOnSpawn = false
  108. gui.Parent = game:GetService("CoreGui")
  109.  
  110. local frame = Instance.new("Frame")
  111. frame.Size = UDim2.new(0, 300, 0, 250)
  112. frame.Position = UDim2.new(0, 20, 0, 60)
  113. frame.BackgroundColor3 = Color3.fromRGB(22, 22, 22)
  114. frame.BorderSizePixel = 0
  115. frame.Active = true
  116. frame.Draggable = true -- bisa di-drag
  117. frame.Parent = gui
  118.  
  119. local uiCorner = Instance.new("UICorner", frame)
  120. uiCorner.CornerRadius = UDim.new(0, 10)
  121.  
  122. local stroke = Instance.new("UIStroke", frame)
  123. stroke.Thickness = 1
  124. stroke.Color = Color3.fromRGB(80, 80, 80)
  125. stroke.Transparency = 0.4
  126.  
  127. local title = Instance.new("TextLabel", frame)
  128. title.Text = "Coordinate Saver"
  129. title.Size = UDim2.new(1, 0, 0, 30)
  130. title.BackgroundTransparency = 1
  131. title.TextColor3 = Color3.new(1,1,1)
  132. title.Font = Enum.Font.GothamBold
  133. title.TextSize = 18
  134. title.Position = UDim2.new(0, 10, 0, 0)
  135. title.TextXAlignment = Enum.TextXAlignment.Left
  136.  
  137. -- ===== Credits kecil =====
  138. local credit = Instance.new("TextLabel", frame)
  139. credit.Size = UDim2.new(1, -20, 0, 14)
  140. credit.Position = UDim2.new(0, 45, 0, 22)
  141. credit.BackgroundTransparency = 1
  142. credit.Text = "by @SukitooV1"
  143. credit.TextColor3 = Color3.fromRGB(160, 160, 160)
  144. credit.Font = Enum.Font.Gotham
  145. credit.TextSize = 11
  146. credit.TextXAlignment = Enum.TextXAlignment.Left
  147.  
  148. -- ===== Tombol Minimize & Close =====
  149. local minimized = false
  150.  
  151. local closeBtn = Instance.new("TextButton", frame)
  152. closeBtn.Size = UDim2.new(0, 30, 0, 24)
  153. closeBtn.Position = UDim2.new(1, -35, 0, 3)
  154. closeBtn.Text = "X"
  155. closeBtn.BackgroundColor3 = Color3.fromRGB(120, 50, 50)
  156. closeBtn.TextColor3 = Color3.new(1,1,1)
  157. closeBtn.BorderSizePixel = 0
  158. closeBtn.Font = Enum.Font.GothamBold
  159. closeBtn.TextSize = 14
  160. local uiCorner = Instance.new("UICorner", closeBtn)
  161. uiCorner.CornerRadius = UDim.new(0, 5)
  162.  
  163. local minBtn = Instance.new("TextButton", frame)
  164. minBtn.Size = UDim2.new(0, 30, 0, 24)
  165. minBtn.Position = UDim2.new(1, -70, 0, 3)
  166. minBtn.Text = "-"
  167. minBtn.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
  168. minBtn.TextColor3 = Color3.new(1,1,1)
  169. minBtn.BorderSizePixel = 0
  170. minBtn.Font = Enum.Font.GothamBold
  171. minBtn.TextSize = 16
  172. local uiCorner = Instance.new("UICorner", minBtn)
  173. uiCorner.CornerRadius = UDim.new(0, 5)
  174.  
  175. closeBtn.MouseButton1Click:Connect(function()
  176.     gui:Destroy()
  177. end)
  178.  
  179. minBtn.MouseButton1Click:Connect(function()
  180.     minimized = not minimized
  181.     if minimized then
  182.         frame.Size = UDim2.new(0, 280, 0, 38)
  183.         for _,v in pairs(frame:GetChildren()) do
  184.             if v ~= title and v ~= credit and v ~= closeBtn and v ~= minBtn then
  185.                 if v:IsA("GuiObject") then
  186.                     v.Visible = false
  187.                 end
  188.             end
  189.         end
  190.     else
  191.         frame.Size = UDim2.new(0, 280, 0, 230)
  192.         for _,v in pairs(frame:GetChildren()) do
  193.             if v:IsA("GuiObject") then
  194.                 v.Visible = true
  195.             end
  196.         end
  197.     end
  198. end)
  199.  
  200. local nameBox = Instance.new("TextBox", frame)
  201. nameBox.PlaceholderText = "NameCord"
  202. nameBox.Size = UDim2.new(1, -20, 0, 28)
  203. nameBox.Position = UDim2.new(0, 10, 0, 40)
  204. nameBox.Text = ""
  205. nameBox.BackgroundColor3 = Color3.fromRGB(50,50,50)
  206. nameBox.TextColor3 = Color3.new(1,1,1)
  207. nameBox.BorderSizePixel = 0
  208. nameBox.Font = Enum.Font.Gotham
  209. nameBox.TextSize = 14
  210. local uiCorner = Instance.new("UICorner", nameBox)
  211. uiCorner.CornerRadius = UDim.new(0, 5)
  212.  
  213. local saveBtn = Instance.new("TextButton", frame)
  214. saveBtn.Text = "Save"
  215. saveBtn.Size = UDim2.new(0.5, -15, 0, 30)
  216. saveBtn.Position = UDim2.new(0, 10, 0, 80)
  217. saveBtn.BackgroundColor3 = Color3.fromRGB(0, 170, 100)
  218. saveBtn.TextColor3 = Color3.new(1,1,1)
  219. saveBtn.BorderSizePixel = 0
  220. saveBtn.Font = Enum.Font.Gotham
  221. saveBtn.TextSize = 14
  222. local uiCorner = Instance.new("UICorner", saveBtn)
  223. uiCorner.CornerRadius = UDim.new(0, 8)
  224.  
  225. local refreshBtn = Instance.new("TextButton", frame)
  226. refreshBtn.Text = "Refresh List"
  227. refreshBtn.Size = UDim2.new(0.5, -15, 0, 30)
  228. refreshBtn.Position = UDim2.new(0.5, 5, 0, 80)
  229. refreshBtn.BackgroundColor3 = Color3.fromRGB(60, 130, 255)
  230. refreshBtn.TextColor3 = Color3.new(1,1,1)
  231. refreshBtn.BorderSizePixel = 0
  232. refreshBtn.Font = Enum.Font.Gotham
  233. refreshBtn.TextSize = 14
  234. local uiCorner = Instance.new("UICorner", refreshBtn)
  235. uiCorner.CornerRadius = UDim.new(0, 8)
  236.  
  237. local listFrame = Instance.new("ScrollingFrame", frame)
  238. listFrame.Size = UDim2.new(1, -20, 0, 100)
  239. listFrame.Position = UDim2.new(0, 10, 0, 120)
  240. listFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
  241. listFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
  242. listFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  243. listFrame.BorderSizePixel = 0
  244. listFrame.ScrollBarThickness = 6
  245.  
  246. local layout = Instance.new("UIListLayout", listFrame)
  247. layout.SortOrder = Enum.SortOrder.LayoutOrder
  248. layout.Padding = UDim.new(0, 5)
  249.  
  250. local function refreshList()
  251.     for _,v in pairs(listFrame:GetChildren()) do
  252.         if v:IsA("Frame") then v:Destroy() end
  253.     end
  254.  
  255.     local coords = loadCoords()
  256.  
  257.     local keys = {}
  258.     for name in pairs(coords) do
  259.         table.insert(keys, name)
  260.     end
  261.     table.sort(keys, function(a, b)
  262.         return string.lower(a) < string.lower(b)
  263.     end)
  264.  
  265.     for _, name in ipairs(keys) do
  266.         local pos = coords[name]
  267.  
  268.         local item = Instance.new("Frame", listFrame)
  269.         item.Size = UDim2.new(1, 0, 0, 30)
  270.         item.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  271.         item.BorderSizePixel = 0
  272.         local uiCorner = Instance.new("UICorner", item)
  273.         uiCorner.CornerRadius = UDim.new(0, 7)
  274.  
  275.         local lbl = Instance.new("TextLabel", item)
  276.         lbl.Size = UDim2.new(0.5, 0, 1, 0)
  277.         lbl.BackgroundTransparency = 1
  278.         lbl.Text = name
  279.         lbl.TextColor3 = Color3.new(1,1,1)
  280.         lbl.Font = Enum.Font.Gotham
  281.         lbl.TextSize = 13
  282.         lbl.TextXAlignment = Enum.TextXAlignment.Center
  283.  
  284.         local tpBtn = Instance.new("TextButton", item)
  285.         tpBtn.Size = UDim2.new(0.25, -5, 1, -6)
  286.         tpBtn.Position = UDim2.new(0.5, 5, 0, 3)
  287.         tpBtn.Text = "TP"
  288.         tpBtn.Font = Enum.Font.Gotham
  289.         tpBtn.TextColor3 = Color3.new(1,1,1)
  290.         tpBtn.TextSize = 13
  291.         tpBtn.BackgroundColor3 = Color3.fromRGB(80,80,80)
  292.         tpBtn.BorderSizePixel = 0
  293.         local uiCorner = Instance.new("UICorner", tpBtn)
  294.         uiCorner.CornerRadius = UDim.new(0, 6)
  295.         tpBtn.MouseButton1Click:Connect(function()
  296.             tpCoord(name)
  297.         end)
  298.  
  299.         local delBtn = Instance.new("TextButton", item)
  300.         delBtn.Size = UDim2.new(0.25, -5, 1, -6)
  301.         delBtn.Position = UDim2.new(0.75, 5, 0, 3)
  302.         delBtn.Text = "DEL"
  303.         delBtn.Font = Enum.Font.Gotham
  304.         delBtn.TextColor3 = Color3.new(1,1,1)
  305.         delBtn.TextSize = 13
  306.         delBtn.BackgroundColor3 = Color3.fromRGB(120,50,50)
  307.         delBtn.BorderSizePixel = 0
  308.         local uiCorner = Instance.new("UICorner", delBtn)
  309.         uiCorner.CornerRadius = UDim.new(0, 6)
  310.         delBtn.MouseButton1Click:Connect(function()
  311.             delCoord(name)
  312.             refreshList()
  313.         end)
  314.     end
  315. end
  316.  
  317. saveBtn.MouseButton1Click:Connect(function()
  318.     addCoord(nameBox.Text)
  319.     refreshList()
  320. end)
  321.  
  322. refreshBtn.MouseButton1Click:Connect(refreshList)
  323. refreshList()
  324.  
  325. -- Fungsi global untuk command bar executor
  326. getgenv().Coords = {
  327.     add = addCoord,
  328.     tp = tpCoord,
  329.     remove = delCoord,
  330.     list = listCoords
  331. }
  332.  
  333. print("✅ Coordinate Saver aktif!")
  334. print("Gunakan juga command:")
  335. print("Coords.add('Nama'), Coords.tp('Nama'), Coords.remove('Nama'), Coords.list()")
  336.  
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment