Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- // SERVICES // --
- local Players = game:GetService("Players")
- local CoreGui = game:GetService("CoreGui")
- local HttpService = game:GetService("HttpService")
- local UserInputService = game:GetService("UserInputService")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- local FileName = "MobileAnimSaves_Converted.json" -- Changed name to avoid conflicts
- -- // SAVE SYSTEM // --
- local SavedAnimations = {}
- local function LoadData()
- if isfile and isfile(FileName) then
- local success, result = pcall(function()
- return HttpService:JSONDecode(readfile(FileName))
- end)
- if success then
- SavedAnimations = result
- end
- end
- end
- local function SaveData()
- if writefile then
- writefile(FileName, HttpService:JSONEncode(SavedAnimations))
- end
- end
- LoadData()
- -- // CONVERSION LOGIC // --
- local function ConvertToAnimID(catalogID)
- -- If it's already an asset link, just return it
- if string.find(catalogID, "rbxassetid") then
- return catalogID
- end
- -- Attempt to convert via game:GetObjects
- local success, result = pcall(function()
- local objects = game:GetObjects("rbxassetid://" .. catalogID)
- local foundAnim = nil
- for _, obj in pairs(objects) do
- if obj:IsA("Animation") then
- foundAnim = obj
- break
- else
- local child = obj:FindFirstChildWhichIsA("Animation", true)
- if child then
- foundAnim = child
- break
- end
- end
- end
- -- Cleanup
- for _, obj in pairs(objects) do
- obj:Destroy()
- end
- return foundAnim and foundAnim.AnimationId or nil
- end)
- if success and result then
- return result
- else
- return nil
- end
- end
- -- // UI SETUP // --
- local ScreenGui = Instance.new("ScreenGui")
- ScreenGui.Name = "DeltaAnimConverterUI"
- pcall(function() ScreenGui.Parent = gethui and gethui() or CoreGui end)
- if not ScreenGui.Parent then ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") end
- -- Helper: Rounded Corners
- local function AddCorner(instance, radius)
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, radius)
- corner.Parent = instance
- return corner
- end
- -- Helper: Draggable
- local function MakeDraggable(guiObject, dragHandle)
- local dragging, dragInput, dragStart, startPos
- local handle = dragHandle or guiObject
- handle.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = guiObject.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then dragging = false end
- end)
- end
- end)
- guiObject.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- local delta = input.Position - dragStart
- guiObject.Position = UDim2.new(
- startPos.X.Scale, startPos.X.Offset + delta.X,
- startPos.Y.Scale, startPos.Y.Offset + delta.Y
- )
- end
- end)
- end
- -- // UI CONSTRUCTION // --
- -- Toggle Button
- local ToggleBtn = Instance.new("TextButton")
- ToggleBtn.Size = UDim2.new(0, 50, 0, 50)
- ToggleBtn.Position = UDim2.new(0, 20, 0.4, 0)
- ToggleBtn.BackgroundColor3 = Color3.fromRGB(0, 120, 215)
- ToggleBtn.Text = "UI"
- ToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- ToggleBtn.Font = Enum.Font.GothamBold
- ToggleBtn.TextSize = 18
- ToggleBtn.Parent = ScreenGui
- AddCorner(ToggleBtn, 12)
- MakeDraggable(ToggleBtn)
- -- Main Frame
- local MainFrame = Instance.new("Frame")
- MainFrame.Size = UDim2.new(0, 320, 0, 400)
- MainFrame.Position = UDim2.new(0.5, -160, 0.5, -200)
- MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
- MainFrame.Visible = false
- MainFrame.Parent = ScreenGui
- AddCorner(MainFrame, 12)
- -- Title Bar
- local TitleBar = Instance.new("Frame")
- TitleBar.Size = UDim2.new(1, 0, 0, 45)
- TitleBar.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
- TitleBar.Parent = MainFrame
- AddCorner(TitleBar, 12)
- local TitleLabel = Instance.new("TextLabel")
- TitleLabel.Text = "AUTO CONVERTER & PLAYER"
- TitleLabel.Size = UDim2.new(1, 0, 1, 0)
- TitleLabel.BackgroundTransparency = 1
- TitleLabel.TextColor3 = Color3.fromRGB(220, 220, 220)
- TitleLabel.Font = Enum.Font.GothamBold
- TitleLabel.TextSize = 14
- TitleLabel.Parent = TitleBar
- MakeDraggable(MainFrame, TitleBar)
- local CloseMain = Instance.new("TextButton")
- CloseMain.Size = UDim2.new(0, 45, 0, 45)
- CloseMain.Position = UDim2.new(1, -45, 0, 0)
- CloseMain.BackgroundTransparency = 1
- CloseMain.Text = "X"
- CloseMain.TextColor3 = Color3.fromRGB(200, 50, 50)
- CloseMain.Font = Enum.Font.GothamBold
- CloseMain.TextSize = 20
- CloseMain.Parent = TitleBar
- CloseMain.MouseButton1Click:Connect(function() MainFrame.Visible = false end)
- ToggleBtn.MouseButton1Click:Connect(function() MainFrame.Visible = not MainFrame.Visible end)
- -- Tabs
- local TabFrame = Instance.new("Frame")
- TabFrame.Size = UDim2.new(0.9, 0, 0, 40)
- TabFrame.Position = UDim2.new(0.05, 0, 0.14, 0)
- TabFrame.BackgroundTransparency = 1
- TabFrame.Parent = MainFrame
- local function CreateTab(text, xPos)
- local btn = Instance.new("TextButton")
- btn.Size = UDim2.new(0.48, 0, 1, 0)
- btn.Position = UDim2.new(xPos, 0, 0, 0)
- btn.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
- btn.Text = text
- btn.TextColor3 = Color3.fromRGB(255, 255, 255)
- btn.Font = Enum.Font.GothamBold
- btn.TextSize = 14
- btn.Parent = TabFrame
- AddCorner(btn, 8)
- return btn
- end
- local ImportTab = CreateTab("Converter", 0)
- local SavedTab = CreateTab("Saved List", 0.52)
- -- Pages
- local PageFrame = Instance.new("Frame")
- PageFrame.Size = UDim2.new(0.9, 0, 0.7, 0)
- PageFrame.Position = UDim2.new(0.05, 0, 0.27, 0)
- PageFrame.BackgroundTransparency = 1
- PageFrame.Parent = MainFrame
- local ImportPage = Instance.new("Frame")
- ImportPage.Size = UDim2.new(1, 0, 1, 0)
- ImportPage.BackgroundTransparency = 1
- ImportPage.Parent = PageFrame
- local SavedPage = Instance.new("ScrollingFrame")
- SavedPage.Size = UDim2.new(1, 0, 1, 0)
- SavedPage.BackgroundTransparency = 1
- SavedPage.ScrollBarThickness = 4
- SavedPage.Visible = false
- SavedPage.Parent = PageFrame
- local UIList = Instance.new("UIListLayout")
- UIList.Padding = UDim.new(0, 8)
- UIList.Parent = SavedPage
- -- // CONVERTER PAGE // --
- local IDBox = Instance.new("TextBox")
- IDBox.Size = UDim2.new(1, 0, 0, 45)
- IDBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- IDBox.TextColor3 = Color3.fromRGB(255, 255, 255)
- IDBox.PlaceholderText = "Paste Catalog ID Here"
- IDBox.Text = ""
- IDBox.Font = Enum.Font.Gotham
- IDBox.TextSize = 14
- IDBox.Parent = ImportPage
- AddCorner(IDBox, 8)
- local NameBox = Instance.new("TextBox")
- NameBox.Size = UDim2.new(1, 0, 0, 45)
- NameBox.Position = UDim2.new(0, 0, 0, 55)
- NameBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- NameBox.TextColor3 = Color3.fromRGB(255, 255, 255)
- NameBox.PlaceholderText = "Name (e.g. Griddy)"
- NameBox.Text = ""
- NameBox.Font = Enum.Font.Gotham
- NameBox.TextSize = 14
- NameBox.Parent = ImportPage
- AddCorner(NameBox, 8)
- local ConvertSaveBtn = Instance.new("TextButton")
- ConvertSaveBtn.Size = UDim2.new(1, 0, 0, 50)
- ConvertSaveBtn.Position = UDim2.new(0, 0, 0, 110)
- ConvertSaveBtn.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
- ConvertSaveBtn.Text = "CONVERT & SAVE"
- ConvertSaveBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- ConvertSaveBtn.Font = Enum.Font.GothamBold
- ConvertSaveBtn.TextSize = 16
- ConvertSaveBtn.Parent = ImportPage
- AddCorner(ConvertSaveBtn, 8)
- local StatusLabel = Instance.new("TextLabel")
- StatusLabel.Size = UDim2.new(1, 0, 0, 30)
- StatusLabel.Position = UDim2.new(0, 0, 0, 170)
- StatusLabel.BackgroundTransparency = 1
- StatusLabel.Text = "Idle"
- StatusLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
- StatusLabel.Font = Enum.Font.Gotham
- StatusLabel.TextSize = 12
- StatusLabel.Parent = ImportPage
- -- // POPUP CONTROLLER (PLAYER) // --
- local ControlFrame = Instance.new("Frame")
- ControlFrame.Size = UDim2.new(0, 220, 0, 140)
- ControlFrame.Position = UDim2.new(0.5, 30, 0.4, 0)
- ControlFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- ControlFrame.Visible = false
- ControlFrame.Parent = ScreenGui
- AddCorner(ControlFrame, 12)
- MakeDraggable(ControlFrame)
- local ControlTitle = Instance.new("TextLabel")
- ControlTitle.Size = UDim2.new(1, 0, 0, 30)
- ControlTitle.BackgroundTransparency = 1
- ControlTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
- ControlTitle.Font = Enum.Font.GothamBold
- ControlTitle.TextSize = 14
- ControlTitle.Text = "Selected Animation"
- ControlTitle.Parent = ControlFrame
- local CloseControl = Instance.new("TextButton")
- CloseControl.Size = UDim2.new(0, 30, 0, 30)
- CloseControl.Position = UDim2.new(1, -30, 0, 0)
- CloseControl.BackgroundTransparency = 1
- CloseControl.Text = "X"
- CloseControl.TextColor3 = Color3.fromRGB(200, 50, 50)
- CloseControl.Font = Enum.Font.GothamBold
- CloseControl.TextSize = 18
- CloseControl.Parent = ControlFrame
- CloseControl.MouseButton1Click:Connect(function() ControlFrame.Visible = false end)
- local PlayBtn = Instance.new("TextButton")
- PlayBtn.Size = UDim2.new(0.9, 0, 0, 40)
- PlayBtn.Position = UDim2.new(0.05, 0, 0.25, 0)
- PlayBtn.BackgroundColor3 = Color3.fromRGB(40, 200, 40)
- PlayBtn.Text = "PLAY"
- PlayBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- PlayBtn.Font = Enum.Font.GothamBold
- PlayBtn.TextSize = 16
- PlayBtn.Parent = ControlFrame
- AddCorner(PlayBtn, 8)
- local StopBtn = Instance.new("TextButton")
- StopBtn.Size = UDim2.new(0.9, 0, 0, 40)
- StopBtn.Position = UDim2.new(0.05, 0, 0.6, 0)
- StopBtn.BackgroundColor3 = Color3.fromRGB(200, 40, 40)
- StopBtn.Text = "STOP"
- StopBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- StopBtn.Font = Enum.Font.GothamBold
- StopBtn.TextSize = 16
- StopBtn.Parent = ControlFrame
- AddCorner(StopBtn, 8)
- -- // LOGIC // --
- local currentTrack = nil
- local currentID = ""
- local function RefreshList()
- for _, v in pairs(SavedPage:GetChildren()) do
- if v:IsA("Frame") then v:Destroy() end
- end
- for i, data in ipairs(SavedAnimations) do
- local ItemFrame = Instance.new("Frame")
- ItemFrame.Size = UDim2.new(1, 0, 0, 50)
- ItemFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
- ItemFrame.Parent = SavedPage
- AddCorner(ItemFrame, 8)
- local SelectBtn = Instance.new("TextButton")
- SelectBtn.Size = UDim2.new(0.75, 0, 1, 0)
- SelectBtn.BackgroundTransparency = 1
- SelectBtn.Text = " " .. data.Name
- SelectBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- SelectBtn.TextXAlignment = Enum.TextXAlignment.Left
- SelectBtn.Font = Enum.Font.GothamBold
- SelectBtn.TextSize = 14
- SelectBtn.Parent = ItemFrame
- SelectBtn.MouseButton1Click:Connect(function()
- ControlFrame.Visible = true
- ControlTitle.Text = data.Name
- currentID = data.ID
- end)
- local DeleteBtn = Instance.new("TextButton")
- DeleteBtn.Size = UDim2.new(0.2, 0, 0.8, 0)
- DeleteBtn.Position = UDim2.new(0.78, 0, 0.1, 0)
- DeleteBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
- DeleteBtn.Text = "DEL"
- DeleteBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- DeleteBtn.Font = Enum.Font.GothamBold
- DeleteBtn.TextSize = 12
- DeleteBtn.Parent = ItemFrame
- AddCorner(DeleteBtn, 6)
- DeleteBtn.MouseButton1Click:Connect(function()
- table.remove(SavedAnimations, i)
- SaveData()
- RefreshList()
- end)
- end
- SavedPage.CanvasSize = UDim2.new(0, 0, 0, UIList.AbsoluteContentSize.Y + 10)
- end
- -- Play Logic
- PlayBtn.MouseButton1Click:Connect(function()
- if not currentID or currentID == "" then return end
- local char = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
- local hum = char:FindFirstChild("Humanoid")
- local animator = hum:FindFirstChild("Animator") or Instance.new("Animator", hum)
- if currentTrack then currentTrack:Stop() end
- local anim = Instance.new("Animation")
- anim.AnimationId = currentID -- ID is already converted in the list
- currentTrack = animator:LoadAnimation(anim)
- currentTrack.Priority = Enum.AnimationPriority.Action
- currentTrack:Play()
- end)
- StopBtn.MouseButton1Click:Connect(function()
- if currentTrack then currentTrack:Stop() end
- end)
- -- Tab Switching
- ImportTab.MouseButton1Click:Connect(function()
- ImportPage.Visible = true
- SavedPage.Visible = false
- ImportTab.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- SavedTab.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
- end)
- SavedTab.MouseButton1Click:Connect(function()
- ImportPage.Visible = false
- SavedPage.Visible = true
- ImportTab.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
- SavedTab.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- RefreshList()
- end)
- -- CONVERT AND SAVE BUTTON LOGIC
- ConvertSaveBtn.MouseButton1Click:Connect(function()
- local rawInput = IDBox.Text
- local nameInput = NameBox.Text
- if rawInput == "" or nameInput == "" then
- StatusLabel.Text = "Please fill in both boxes!"
- StatusLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
- return
- end
- ConvertSaveBtn.Text = "CONVERTING..."
- StatusLabel.Text = "Fetching ID from Roblox..."
- StatusLabel.TextColor3 = Color3.fromRGB(255, 255, 100)
- -- Run conversion
- local finalID = ConvertToAnimID(rawInput)
- if finalID then
- -- Success
- table.insert(SavedAnimations, {Name = nameInput, ID = finalID})
- SaveData()
- ConvertSaveBtn.Text = "SUCCESS!"
- StatusLabel.Text = "Saved: " .. finalID
- StatusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
- IDBox.Text = ""
- NameBox.Text = ""
- task.wait(1)
- ConvertSaveBtn.Text = "CONVERT & SAVE"
- StatusLabel.Text = "Idle"
- StatusLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
- else
- -- Fail
- ConvertSaveBtn.Text = "FAILED"
- StatusLabel.Text = "Could not find animation in that ID."
- StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
- task.wait(1.5)
- ConvertSaveBtn.Text = "CONVERT & SAVE"
- end
- end)
- RefreshList()
Advertisement
Add Comment
Please, Sign In to add comment