--// 📱 Ultimate Mobile Save/Load TP GUI (Draggable, Persistent) --// One single LocalScript — works on PC & Mobile --// by ChatGPT 😎 local plr = game.Players.LocalPlayer local PlayerGui = plr:WaitForChild("PlayerGui") local HttpService = game:GetService("HttpService") local UIS = game:GetService("UserInputService") local SAVE_FILE = "TP_Slots_" .. plr.UserId .. ".json" --// === File Save Helpers === local function saveToFile(data) if not writefile then return end local ok, encoded = pcall(function() return HttpService:JSONEncode(data) end) if ok then writefile(SAVE_FILE, encoded) end end local function loadFromFile() if readfile and isfile and isfile(SAVE_FILE) then local ok, decoded = pcall(function() return HttpService:JSONDecode(readfile(SAVE_FILE)) end) if ok and type(decoded) == "table" then return decoded end end return {} end local savedTPs = loadFromFile() --// === GUI Creation === local gui = Instance.new("ScreenGui") gui.Name = "TP_GUI" gui.ResetOnSpawn = false gui.Parent = PlayerGui local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 320, 0, 400) frame.Position = UDim2.new(0.35, 0, 0.3, 0) frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35) frame.Parent = gui Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 10) -- Title bar local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 30) titleBar.BackgroundColor3 = Color3.fromRGB(50, 50, 50) titleBar.Parent = frame local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, -60, 1, 0) titleLabel.Position = UDim2.new(0, 10, 0, 0) titleLabel.Text = "📍 Save/Load TP GUI" titleLabel.TextColor3 = Color3.new(1, 1, 1) titleLabel.BackgroundTransparency = 1 titleLabel.Font = Enum.Font.SourceSansBold titleLabel.TextXAlignment = Enum.TextXAlignment.Left titleLabel.TextSize = 18 titleLabel.Parent = titleBar local closeBtn = Instance.new("TextButton") closeBtn.Size = UDim2.new(0, 30, 1, 0) closeBtn.Position = UDim2.new(1, -35, 0, 0) closeBtn.Text = "✖" closeBtn.TextColor3 = Color3.new(1, 1, 1) closeBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 60) closeBtn.Parent = titleBar local minimizeBtn = Instance.new("TextButton") minimizeBtn.Size = UDim2.new(0, 30, 1, 0) minimizeBtn.Position = UDim2.new(1, -70, 0, 0) minimizeBtn.Text = "–" minimizeBtn.TextColor3 = Color3.new(1, 1, 1) minimizeBtn.BackgroundColor3 = Color3.fromRGB(100, 100, 100) minimizeBtn.Parent = titleBar -- Scroll container local scroll = Instance.new("ScrollingFrame") scroll.Size = UDim2.new(1, -20, 1, -40) scroll.Position = UDim2.new(0, 10, 0, 40) scroll.BackgroundTransparency = 1 scroll.ScrollBarThickness = 6 scroll.Parent = frame -- Character tracking local char = plr.Character or plr.CharacterAdded:Wait() local hrp = char:WaitForChild("HumanoidRootPart") plr.CharacterAdded:Connect(function(newChar) char = newChar hrp = newChar:WaitForChild("HumanoidRootPart") end) --// === SLOT CREATION === local function createSlot(i) local slot = Instance.new("Frame") slot.Size = UDim2.new(1, -10, 0, 30) slot.Position = UDim2.new(0, 0, 0, (i - 1) * 35) slot.BackgroundColor3 = Color3.fromRGB(45, 45, 45) slot.Parent = scroll Instance.new("UICorner", slot).CornerRadius = UDim.new(0, 6) local nameBox = Instance.new("TextBox") nameBox.Size = UDim2.new(0.4, 0, 1, 0) nameBox.Position = UDim2.new(0, 5, 0, 0) nameBox.Text = savedTPs[i] and savedTPs[i].Name or ("Slot " .. i) nameBox.TextColor3 = Color3.new(1, 1, 1) nameBox.BackgroundColor3 = Color3.fromRGB(60, 60, 60) nameBox.ClearTextOnFocus = false nameBox.Font = Enum.Font.SourceSans nameBox.TextSize = 16 nameBox.Parent = slot local saveBtn = Instance.new("TextButton") saveBtn.Size = UDim2.new(0.25, 0, 0.8, 0) saveBtn.Position = UDim2.new(0.45, 0, 0.1, 0) saveBtn.Text = "💾 Save" saveBtn.TextColor3 = Color3.new(1, 1, 1) saveBtn.BackgroundColor3 = Color3.fromRGB(70, 170, 90) saveBtn.Font = Enum.Font.SourceSansBold saveBtn.TextSize = 16 saveBtn.Parent = slot local loadBtn = Instance.new("TextButton") loadBtn.Size = UDim2.new(0.25, 0, 0.8, 0) loadBtn.Position = UDim2.new(0.72, 0, 0.1, 0) loadBtn.Text = "📍 Load" loadBtn.TextColor3 = Color3.new(1, 1, 1) loadBtn.BackgroundColor3 = Color3.fromRGB(80, 130, 230) loadBtn.Font = Enum.Font.SourceSansBold loadBtn.TextSize = 16 loadBtn.Parent = slot saveBtn.MouseButton1Click:Connect(function() local c = plr.Character or plr.CharacterAdded:Wait() local h = c:WaitForChild("HumanoidRootPart") savedTPs[i] = { Name = nameBox.Text, CFrame = { Position = { x = h.Position.X, y = h.Position.Y, z = h.Position.Z }, Look = { x = h.CFrame.LookVector.X, y = h.CFrame.LookVector.Y, z = h.CFrame.LookVector.Z } } } saveBtn.Text = "✅ Saved" saveToFile(savedTPs) task.wait(1) saveBtn.Text = "💾 Save" end) loadBtn.MouseButton1Click:Connect(function() local data = savedTPs[i] if data and data.CFrame then local c = plr.Character or plr.CharacterAdded:Wait() local h = c:WaitForChild("HumanoidRootPart") local p, l = data.CFrame.Position, data.CFrame.Look h.CFrame = CFrame.new(Vector3.new(p.x, p.y, p.z), Vector3.new(p.x + l.x, p.y + l.y, p.z + l.z)) loadBtn.Text = "✅ Loaded" else loadBtn.Text = "❌ Empty" end task.wait(1) loadBtn.Text = "📍 Load" end) nameBox.FocusLost:Connect(function() if savedTPs[i] then savedTPs[i].Name = nameBox.Text saveToFile(savedTPs) end end) end for i = 1, 10 do createSlot(i) end scroll.CanvasSize = UDim2.new(0, 0, 0, 10 * 35 + 10) --// === MOBILE + PC DRAGGING === local dragging = false local dragStart, startPos local function beginDrag(input) dragging = true dragStart = input.Position startPos = frame.Position end local function endDrag() dragging = false end local function moveDrag(input) if dragging then local delta = input.Position - dragStart frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end -- Works on both Mouse & Touch titleBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then beginDrag(input) end end) titleBar.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then endDrag() end end) UIS.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then moveDrag(input) end end) --// === Minimize & Close === local minimized = false minimizeBtn.MouseButton1Click:Connect(function() minimized = not minimized scroll.Visible = not minimized frame.Size = minimized and UDim2.new(0, 320, 0, 30) or UDim2.new(0, 320, 0, 400) end) closeBtn.MouseButton1Click:Connect(function() gui.Enabled = false end)