Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- seems very bad and simple but what this does is it creates your character as a clone and lets you record animations in other games
- -- and lets you play those animations back onto a clone and yes its also ai made but took a while cuz ai cant code
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local UserInputService = game:GetService("UserInputService")
- local HttpService = game:GetService("HttpService")
- local TweenService = game:GetService("TweenService")
- local player = Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- local CLONE_DISTANCE = 5
- local RECORD_KEY = Enum.KeyCode.E
- local REPLAY_KEY = Enum.KeyCode.R
- local RESPAWN_KEY = Enum.KeyCode.T
- local FOLDER_NAME = "AnimTesting"
- local myClone = nil
- local isRecording = false
- local recordedFrames = {}
- local recordConnection = nil
- local replayConnection = nil
- local isReplaying = false
- local isLooping = false
- local playerBodyParts = {}
- local cloneBodyParts = {}
- local dragging = false
- local dragInput = nil
- local dragStart = nil
- local startPos = nil
- local bodyPartNames = {
- "Head", "HumanoidRootPart", "Left Arm", "Left Leg",
- "Right Arm", "Right Leg", "Torso"
- }
- local FileSystem = {
- Enabled = (getgenv and (writefile or getgenv().writefile)) ~= nil,
- Write = writefile or (getgenv and getgenv().writefile),
- Read = readfile or (getgenv and getgenv().readfile),
- List = listfiles or (getgenv and getgenv().listfiles),
- IsFolder = isfolder or (getgenv and getgenv().isfolder),
- MakeFolder = makefolder or (getgenv and getgenv().makefolder)
- }
- if FileSystem.Enabled then
- if not FileSystem.IsFolder(FOLDER_NAME) then
- FileSystem.MakeFolder(FOLDER_NAME)
- end
- end
- local function createDummy()
- local dummy = Instance.new("Model")
- dummy.Name = "Clone"
- local hrp = Instance.new("Part")
- hrp.Name = "HumanoidRootPart"
- hrp.Size = Vector3.new(2, 2, 1)
- hrp.Transparency = 1
- hrp.CanCollide = false
- hrp.Parent = dummy
- local humanoid = Instance.new("Humanoid")
- humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
- humanoid.Parent = dummy
- local function createPart(name, size)
- local part = Instance.new("Part")
- part.Name = name
- part.Size = size
- part.TopSurface = Enum.SurfaceType.Smooth
- part.BottomSurface = Enum.SurfaceType.Smooth
- part.CanCollide = false
- part.Parent = dummy
- return part
- end
- local head = createPart("Head", Vector3.new(2, 1, 1))
- local headMesh = Instance.new("SpecialMesh")
- headMesh.MeshType = Enum.MeshType.Head
- headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
- headMesh.Parent = head
- local torso = createPart("Torso", Vector3.new(2, 2, 1))
- local leftArm = createPart("Left Arm", Vector3.new(1, 2, 1))
- local rightArm = createPart("Right Arm", Vector3.new(1, 2, 1))
- local leftLeg = createPart("Left Leg", Vector3.new(1, 2, 1))
- local rightLeg = createPart("Right Leg", Vector3.new(1, 2, 1))
- local function createMotor(name, part0, part1, c0, c1)
- local motor = Instance.new("Motor6D")
- motor.Name = name
- motor.Part0 = part0
- motor.Part1 = part1
- motor.C0 = c0
- motor.C1 = c1
- motor.Parent = part0
- return motor
- end
- createMotor("Neck", torso, head, CFrame.new(0, 1, 0), CFrame.new(0, -0.5, 0))
- createMotor("Left Shoulder", torso, leftArm, CFrame.new(-1, 0.5, 0), CFrame.new(0.5, 0.5, 0))
- createMotor("Right Shoulder", torso, rightArm, CFrame.new(1, 0.5, 0), CFrame.new(-0.5, 0.5, 0))
- createMotor("Left Hip", torso, leftLeg, CFrame.new(-0.5, -1, 0), CFrame.new(0, 1, 0))
- createMotor("Right Hip", torso, rightLeg, CFrame.new(0.5, -1, 0), CFrame.new(0, 1, 0))
- createMotor("Root Joint", hrp, torso, CFrame.new(0, 0, 0), CFrame.new(0, 0, 0))
- local face = Instance.new("Decal")
- face.Name = "face"
- face.Texture = "rbxasset://textures/face.png"
- face.Parent = head
- dummy.PrimaryPart = hrp
- return dummy
- end
- local function spawnClone()
- if myClone then myClone:Destroy() end
- if not player.Character then return end
- character = player.Character
- humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
- if not humanoidRootPart then return end
- myClone = createDummy()
- local cloneRoot = myClone:FindFirstChild("HumanoidRootPart")
- if cloneRoot then
- cloneRoot.CFrame = humanoidRootPart.CFrame * CFrame.new(0, 0, -CLONE_DISTANCE)
- cloneRoot.CFrame = CFrame.lookAt(cloneRoot.Position, humanoidRootPart.Position)
- end
- myClone.Parent = workspace
- local hum = character:FindFirstChild("Humanoid")
- if hum then
- local success, desc = pcall(function() return hum:GetAppliedDescription() end)
- if success and desc then
- local cloneHumanoid = myClone:FindFirstChildOfClass("Humanoid")
- if cloneHumanoid then pcall(function() cloneHumanoid:ApplyDescription(desc) end) end
- end
- end
- end
- local function serializeFrames(frames)
- local data = {}
- for i, frame in ipairs(frames) do
- data[i] = {}
- for partName, partData in pairs(frame) do
- data[i][partName] = {partData.CFrame:components()}
- end
- end
- return HttpService:JSONEncode(data)
- end
- local function deserializeFrames(jsonString)
- local rawData = HttpService:JSONDecode(jsonString)
- local frames = {}
- for i, rawFrame in ipairs(rawData) do
- frames[i] = {}
- for partName, components in pairs(rawFrame) do
- frames[i][partName] = { CFrame = CFrame.new(unpack(components)) }
- end
- end
- return frames
- end
- local function createModernGUI()
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "AnimationTestingUI"
- screenGui.ResetOnSpawn = false
- screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- screenGui.Parent = player:WaitForChild("PlayerGui")
- local mainFrame = Instance.new("Frame")
- mainFrame.Size = UDim2.new(0, 360, 0, 420)
- mainFrame.Position = UDim2.new(0.5, -180, 0, 50)
- mainFrame.BackgroundColor3 = Color3.fromRGB(25, 28, 33)
- mainFrame.BackgroundTransparency = 0.9
- mainFrame.BorderSizePixel = 0
- mainFrame.ClipsDescendants = true
- mainFrame.Parent = screenGui
- local mainCorner = Instance.new("UICorner")
- mainCorner.CornerRadius = UDim.new(0, 8)
- mainCorner.Parent = mainFrame
- local border = Instance.new("Frame")
- border.Size = UDim2.new(1, 0, 1, 0)
- border.BackgroundColor3 = Color3.fromRGB(60, 65, 75)
- border.BorderSizePixel = 1
- border.BorderColor3 = Color3.fromRGB(40, 45, 55)
- border.BackgroundTransparency = 0.75
- border.Parent = mainFrame
- local borderCorner = Instance.new("UICorner")
- borderCorner.CornerRadius = UDim.new(0, 8)
- borderCorner.Parent = border
- local titleBar = Instance.new("Frame")
- titleBar.Size = UDim2.new(1, 0, 0, 32)
- titleBar.BackgroundColor3 = Color3.fromRGB(35, 40, 48)
- titleBar.BackgroundTransparency = 0.8
- titleBar.BorderSizePixel = 0
- titleBar.Active = true
- titleBar.Parent = mainFrame
- local titleBarCorner = Instance.new("UICorner")
- titleBarCorner.CornerRadius = UDim.new(0, 8)
- titleBarCorner.Parent = titleBar
- local title = Instance.new("TextLabel")
- title.Size = UDim2.new(0, 200, 1, 0)
- title.Position = UDim2.new(0, 12, 0, 0)
- title.Text = "ANIMATION TESTING"
- title.TextColor3 = Color3.fromRGB(220, 220, 230)
- title.TextSize = 16
- title.Font = Enum.Font.GothamBold
- title.BackgroundTransparency = 1
- title.Parent = titleBar
- local closeButton = Instance.new("TextButton")
- closeButton.Size = UDim2.new(0, 24, 0, 24)
- closeButton.Position = UDim2.new(1, -36, 0.5, -12)
- closeButton.Text = "×"
- closeButton.TextSize = 22
- closeButton.Font = Enum.Font.GothamBold
- closeButton.TextColor3 = Color3.fromRGB(200, 200, 220)
- closeButton.BackgroundColor3 = Color3.fromRGB(200, 70, 70)
- closeButton.BackgroundTransparency = 0.2
- closeButton.BorderSizePixel = 0
- closeButton.Parent = titleBar
- local closeCorner = Instance.new("UICorner")
- closeCorner.CornerRadius = UDim.new(0, 6)
- closeCorner.Parent = closeButton
- local statusFrame = Instance.new("Frame")
- statusFrame.Size = UDim2.new(1, -20, 0, 28)
- statusFrame.Position = UDim2.new(0, 10, 0, 40)
- statusFrame.BackgroundColor3 = Color3.fromRGB(40, 45, 55)
- statusFrame.BackgroundTransparency = 0.6
- statusFrame.BorderSizePixel = 0
- statusFrame.Parent = mainFrame
- local statusCorner = Instance.new("UICorner")
- statusCorner.CornerRadius = UDim.new(0, 6)
- statusCorner.Parent = statusFrame
- local statusLabel = Instance.new("TextLabel")
- statusLabel.Size = UDim2.new(1, -12, 1, -6)
- statusLabel.Position = UDim2.new(0, 6, 0, 3)
- statusLabel.Text = "Status: Idle"
- statusLabel.TextColor3 = Color3.fromRGB(180, 180, 200)
- statusLabel.TextSize = 14
- statusLabel.Font = Enum.Font.Gotham
- statusLabel.BackgroundTransparency = 1
- statusLabel.Parent = statusFrame
- local keybindsFrame = Instance.new("Frame")
- keybindsFrame.Size = UDim2.new(1, -20, 0, 56)
- keybindsFrame.Position = UDim2.new(0, 10, 0, 72)
- keybindsFrame.BackgroundColor3 = Color3.fromRGB(40, 45, 55)
- keybindsFrame.BackgroundTransparency = 0.6
- keybindsFrame.BorderSizePixel = 0
- keybindsFrame.Parent = mainFrame
- local keybindsCorner = Instance.new("UICorner")
- keybindsCorner.CornerRadius = UDim.new(0, 6)
- keybindsCorner.Parent = keybindsFrame
- local keybindsTitle = Instance.new("TextLabel")
- keybindsTitle.Size = UDim2.new(1, -12, 0, 20)
- keybindsTitle.Position = UDim2.new(0, 6, 0, 4)
- keybindsTitle.Text = "CONTROLS"
- keybindsTitle.TextColor3 = Color3.fromRGB(160, 180, 220)
- keybindsTitle.TextSize = 14
- keybindsTitle.Font = Enum.Font.GothamBold
- keybindsTitle.BackgroundTransparency = 1
- keybindsTitle.Parent = keybindsFrame
- local keybindsText = Instance.new("TextLabel")
- keybindsText.Size = UDim2.new(1, -12, 0, 30)
- keybindsText.Position = UDim2.new(0, 6, 0, 24)
- keybindsText.Text = string.format("Record: %s | Play: %s | Spawn: %s", RECORD_KEY.Name, REPLAY_KEY.Name, RESPAWN_KEY.Name)
- keybindsText.TextColor3 = Color3.fromRGB(200, 210, 230)
- keybindsText.TextSize = 13
- keybindsText.Font = Enum.Font.Gotham
- keybindsText.BackgroundTransparency = 1
- keybindsText.Parent = keybindsFrame
- local loopToggle = Instance.new("TextButton")
- loopToggle.Size = UDim2.new(1, -20, 0, 30)
- loopToggle.Position = UDim2.new(0, 10, 0, 132)
- loopToggle.Text = "LOOP: OFF"
- loopToggle.TextColor3 = Color3.fromRGB(220, 220, 240)
- loopToggle.TextSize = 14
- loopToggle.Font = Enum.Font.GothamBold
- loopToggle.BackgroundColor3 = Color3.fromRGB(100, 60, 60)
- loopToggle.BackgroundTransparency = 0.4
- loopToggle.BorderSizePixel = 0
- loopToggle.Parent = mainFrame
- local loopCorner = Instance.new("UICorner")
- loopCorner.CornerRadius = UDim.new(0, 6)
- loopCorner.Parent = loopToggle
- local divider = Instance.new("Frame")
- divider.Size = UDim2.new(1, -20, 0, 1)
- divider.Position = UDim2.new(0, 10, 0, 166)
- divider.BackgroundColor3 = Color3.fromRGB(70, 80, 90)
- divider.BackgroundTransparency = 0.7
- divider.BorderSizePixel = 0
- divider.Parent = mainFrame
- local saveFrame = Instance.new("Frame")
- saveFrame.Size = UDim2.new(1, -20, 0, 48)
- saveFrame.Position = UDim2.new(0, 10, 0, 172)
- saveFrame.BackgroundColor3 = Color3.fromRGB(40, 45, 55)
- saveFrame.BackgroundTransparency = 0.6
- saveFrame.BorderSizePixel = 0
- saveFrame.Parent = mainFrame
- local saveCorner = Instance.new("UICorner")
- saveCorner.CornerRadius = UDim.new(0, 6)
- saveCorner.Parent = saveFrame
- local nameLabel = Instance.new("TextLabel")
- nameLabel.Size = UDim2.new(1, -12, 0, 20)
- nameLabel.Position = UDim2.new(0, 6, 0, 4)
- nameLabel.Text = "ANIMATION NAME"
- nameLabel.TextColor3 = Color3.fromRGB(180, 190, 220)
- nameLabel.TextSize = 14
- nameLabel.Font = Enum.Font.Gotham
- nameLabel.BackgroundTransparency = 1
- nameLabel.Parent = saveFrame
- local saveBox = Instance.new("TextBox")
- saveBox.Size = UDim2.new(0.7, -6, 0, 24)
- saveBox.Position = UDim2.new(0, 6, 0, 24)
- saveBox.BackgroundColor3 = Color3.fromRGB(50, 55, 65)
- saveBox.TextColor3 = Color3.fromRGB(220, 220, 240)
- saveBox.TextSize = 14
- saveBox.Font = Enum.Font.Gotham
- saveBox.PlaceholderColor3 = Color3.fromRGB(150, 160, 180)
- saveBox.PlaceholderText = "Enter animation name"
- saveBox.ClearTextOnFocus = false
- saveBox.BorderSizePixel = 0
- saveBox.Parent = saveFrame
- local boxCorner = Instance.new("UICorner")
- boxCorner.CornerRadius = UDim.new(0, 4)
- boxCorner.Parent = saveBox
- local saveBtn = Instance.new("TextButton")
- saveBtn.Size = UDim2.new(0.3, -6, 0, 24)
- saveBtn.Position = UDim2.new(0.7, 6, 0, 24)
- saveBtn.Text = "SAVE"
- saveBtn.TextColor3 = Color3.fromRGB(240, 240, 255)
- saveBtn.TextSize = 14
- saveBtn.Font = Enum.Font.GothamBold
- saveBtn.BackgroundColor3 = Color3.fromRGB(50, 140, 70)
- saveBtn.BackgroundTransparency = 0.3
- saveBtn.BorderSizePixel = 0
- saveBtn.Parent = saveFrame
- local btnCorner = Instance.new("UICorner")
- btnCorner.CornerRadius = UDim.new(0, 4)
- btnCorner.Parent = saveBtn
- local listBtn = Instance.new("TextButton")
- listBtn.Size = UDim2.new(1, -20, 0, 32)
- listBtn.Position = UDim2.new(0, 10, 0, 224)
- listBtn.Text = "📁 ANIMATION LIBRARY"
- listBtn.TextColor3 = Color3.fromRGB(220, 220, 240)
- listBtn.TextSize = 15
- listBtn.Font = Enum.Font.GothamBold
- listBtn.BackgroundColor3 = Color3.fromRGB(60, 100, 140)
- listBtn.BackgroundTransparency = 0.4
- listBtn.BorderSizePixel = 0
- listBtn.Parent = mainFrame
- local listBtnCorner = Instance.new("UICorner")
- listBtnCorner.CornerRadius = UDim.new(0, 6)
- listBtnCorner.Parent = listBtn
- local fileListFrame = Instance.new("Frame")
- fileListFrame.Size = UDim2.new(1, -20, 0, 110)
- fileListFrame.Position = UDim2.new(0, 10, 0, 260)
- fileListFrame.BackgroundColor3 = Color3.fromRGB(40, 45, 55)
- fileListFrame.BackgroundTransparency = 0.7
- fileListFrame.BorderSizePixel = 0
- fileListFrame.ClipsDescendants = true
- fileListFrame.Visible = false
- fileListFrame.Parent = mainFrame
- local fileListCorner = Instance.new("UICorner")
- fileListCorner.CornerRadius = UDim.new(0, 6)
- fileListCorner.Parent = fileListFrame
- local scrollFrame = Instance.new("ScrollingFrame")
- scrollFrame.Size = UDim2.new(1, -8, 1, -8)
- scrollFrame.Position = UDim2.new(0, 4, 0, 4)
- scrollFrame.BackgroundColor3 = Color3.fromRGB(50, 55, 65)
- scrollFrame.BackgroundTransparency = 0.5
- scrollFrame.BorderSizePixel = 0
- scrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
- scrollFrame.ScrollBarThickness = 6
- scrollFrame.Parent = fileListFrame
- local scrollCorner = Instance.new("UICorner")
- scrollCorner.CornerRadius = UDim.new(0, 4)
- scrollCorner.Parent = scrollFrame
- local scrollBar = Instance.new("UIListLayout")
- scrollBar.SortOrder = Enum.SortOrder.LayoutOrder
- scrollBar.Padding = UDim.new(0, 4)
- scrollBar.Parent = scrollFrame
- local noFilesLabel = Instance.new("TextLabel")
- noFilesLabel.Size = UDim2.new(1, -16, 0, 30)
- noFilesLabel.Position = UDim2.new(0, 8, 0, 8)
- noFilesLabel.Text = "No animations found"
- noFilesLabel.TextColor3 = Color3.fromRGB(150, 160, 180)
- noFilesLabel.TextSize = 14
- noFilesLabel.Font = Enum.Font.Gotham
- noFilesLabel.BackgroundTransparency = 1
- noFilesLabel.Visible = false
- noFilesLabel.Parent = scrollFrame
- local footer = Instance.new("Frame")
- footer.Size = UDim2.new(1, -20, 0, 24)
- footer.Position = UDim2.new(0, 10, 1, -34)
- footer.BackgroundColor3 = Color3.fromRGB(40, 45, 55)
- footer.BackgroundTransparency = 0.6
- footer.BorderSizePixel = 0
- footer.Parent = mainFrame
- local footerCorner = Instance.new("UICorner")
- footerCorner.CornerRadius = UDim.new(0, 8)
- footerCorner.Parent = footer
- local footerText = Instance.new("TextLabel")
- footerText.Size = UDim2.new(1, -16, 1, -4)
- footerText.Position = UDim2.new(0, 8, 0, 2)
- footerText.Text = "Animation System v2.0"
- footerText.TextColor3 = Color3.fromRGB(150, 160, 180)
- footerText.TextSize = 12
- footerText.Font = Enum.Font.Gotham
- footerText.BackgroundTransparency = 1
- footerText.Parent = footer
- -- Make GUI draggable - FIXED PROPERLY
- titleBar.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = mainFrame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- titleBar.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- local delta = input.Position - dragStart
- mainFrame.Position = UDim2.new(
- startPos.X.Scale,
- startPos.X.Offset + delta.X,
- startPos.Y.Scale,
- startPos.Y.Offset + delta.Y
- )
- end
- end)
- closeButton.MouseButton1Click:Connect(function()
- screenGui.Enabled = false
- end)
- -- Add hover effects
- local function addButtonHoverEffect(button, normalColor, hoverColor)
- button.MouseEnter:Connect(function()
- TweenService:Create(button, TweenInfo.new(0.2), {BackgroundColor3 = hoverColor}):Play()
- end)
- button.MouseLeave:Connect(function()
- TweenService:Create(button, TweenInfo.new(0.2), {BackgroundColor3 = normalColor}):Play()
- end)
- end
- addButtonHoverEffect(loopToggle, Color3.fromRGB(100, 60, 60), Color3.fromRGB(130, 70, 70))
- addButtonHoverEffect(saveBtn, Color3.fromRGB(50, 140, 70), Color3.fromRGB(60, 160, 80))
- addButtonHoverEffect(listBtn, Color3.fromRGB(60, 100, 140), Color3.fromRGB(70, 120, 160))
- addButtonHoverEffect(closeButton, Color3.fromRGB(200, 70, 70), Color3.fromRGB(220, 90, 90))
- return screenGui, saveBox, saveBtn, listBtn, scrollFrame, statusLabel, loopToggle, fileListFrame, noFilesLabel
- end
- local gui, saveBox, saveBtn, listBtn, scrollFrame, statusLabel, loopToggle, fileListFrame, noFilesLabel = createModernGUI()
- local function updateStatus(status, color)
- statusLabel.Text = "Status: " .. status
- TweenService:Create(statusLabel, TweenInfo.new(0.3), {
- TextColor3 = color or Color3.fromRGB(180, 180, 200)
- }):Play()
- end
- local function updateGUI()
- if isRecording then
- updateStatus("RECORDING", Color3.fromRGB(220, 80, 80))
- elseif isReplaying then
- updateStatus("PLAYING", Color3.fromRGB(80, 160, 220))
- else
- updateStatus("Idle", Color3.fromRGB(180, 180, 200))
- end
- end
- loopToggle.MouseButton1Click:Connect(function()
- isLooping = not isLooping
- loopToggle.Text = "LOOP: " .. (isLooping and "ON" or "OFF")
- loopToggle.BackgroundColor3 = isLooping and Color3.fromRGB(60, 120, 60) or Color3.fromRGB(100, 60, 60)
- updateGUI()
- end)
- local function refreshFileList()
- if not FileSystem.Enabled then return end
- for _, child in ipairs(scrollFrame:GetChildren()) do
- if child:IsA("TextButton") then
- child:Destroy()
- end
- end
- local files = FileSystem.List(FOLDER_NAME)
- local hasFiles = false
- if files and #files > 0 then
- table.sort(files)
- for _, path in ipairs(files) do
- if path:match("%.json$") then
- hasFiles = true
- local filename = path:match("([^/]+)%.json$")
- local fileBtn = Instance.new("TextButton")
- fileBtn.Size = UDim2.new(1, -8, 0, 28)
- fileBtn.BackgroundColor3 = Color3.fromRGB(55, 60, 70)
- fileBtn.BackgroundTransparency = 0.6
- fileBtn.BorderSizePixel = 0
- fileBtn.TextColor3 = Color3.fromRGB(210, 210, 230)
- fileBtn.TextSize = 14
- fileBtn.Font = Enum.Font.Gotham
- fileBtn.Text = filename
- fileBtn.Parent = scrollFrame
- local fileCorner = Instance.new("UICorner")
- fileCorner.CornerRadius = UDim.new(0, 4)
- fileCorner.Parent = fileBtn
- local fileIcon = Instance.new("TextLabel")
- fileIcon.Size = UDim2.new(0, 20, 1, -4)
- fileIcon.Position = UDim2.new(0, 4, 0, 2)
- fileIcon.Text = "▶"
- fileIcon.TextColor3 = Color3.fromRGB(180, 200, 230)
- fileIcon.Font = Enum.Font.GothamBold
- fileIcon.BackgroundTransparency = 1
- fileIcon.Parent = fileBtn
- fileBtn.MouseButton1Click:Connect(function()
- recordedFrames = deserializeFrames(FileSystem.Read(FOLDER_NAME .. "/" .. filename .. ".json"))
- updateStatus("Loaded: " .. filename)
- end)
- fileBtn.MouseEnter:Connect(function()
- TweenService:Create(fileBtn, TweenInfo.new(0.2), {
- BackgroundColor3 = Color3.fromRGB(70, 75, 85)
- }):Play()
- end)
- fileBtn.MouseLeave:Connect(function()
- TweenService:Create(fileBtn, TweenInfo.new(0.2), {
- BackgroundColor3 = Color3.fromRGB(55, 60, 70)
- }):Play()
- end)
- end
- end
- end
- noFilesLabel.Visible = not hasFiles
- scrollFrame.CanvasSize = UDim2.new(0, 0, 0, math.max(30, #scrollFrame:GetChildren() * 32))
- end
- saveBtn.MouseButton1Click:Connect(function()
- if not FileSystem.Enabled or #recordedFrames == 0 then
- updateStatus("No frames to save!", Color3.fromRGB(220, 100, 100))
- return
- end
- local name = saveBox.Text:trim()
- if name == "" then
- updateStatus("Enter animation name!", Color3.fromRGB(220, 100, 100))
- return
- end
- FileSystem.Write(FOLDER_NAME .. "/" .. name .. ".json", serializeFrames(recordedFrames))
- updateStatus("Saved: " .. name, Color3.fromRGB(100, 200, 100))
- refreshFileList()
- end)
- listBtn.MouseButton1Click:Connect(function()
- fileListFrame.Visible = not fileListFrame.Visible
- listBtn.Text = fileListFrame.Visible and "📁 HIDE LIBRARY" or "📁 ANIMATION LIBRARY"
- if fileListFrame.Visible then
- refreshFileList()
- end
- end)
- -- Auto refresh file list every 0.5 seconds
- spawn(function()
- while wait(0.5) do
- if fileListFrame.Visible and FileSystem.Enabled then
- refreshFileList()
- end
- end
- end)
- local function replayOnClone()
- if isRecording or isReplaying or #recordedFrames == 0 then
- updateStatus("No animation loaded!", Color3.fromRGB(220, 100, 100))
- return
- end
- if not myClone then spawnClone(); wait(0.1) end
- isReplaying = true
- updateGUI()
- local cloneRoot = myClone:FindFirstChild("HumanoidRootPart")
- if cloneRoot then cloneRoot.Anchored = true end
- for _, partName in ipairs(bodyPartNames) do
- local p = myClone:FindFirstChild(partName)
- if p then
- for _, d in pairs(myClone:GetDescendants()) do
- if d:IsA("Motor6D") and d.Part1 == p then d:Destroy() end
- end
- end
- end
- local recStart = recordedFrames[1]["HumanoidRootPart"].CFrame
- local cloneStart = cloneRoot.CFrame
- local offsetMatrix = cloneStart * recStart:Inverse()
- local frameIndex = 1
- replayConnection = RunService.RenderStepped:Connect(function()
- if frameIndex <= #recordedFrames and myClone and myClone.Parent then
- local frameData = recordedFrames[frameIndex]
- for _, partName in ipairs(bodyPartNames) do
- local p = myClone:FindFirstChild(partName)
- if p and frameData[partName] then
- p.CFrame = offsetMatrix * frameData[partName].CFrame
- end
- end
- frameIndex = frameIndex + 1
- else
- if isLooping and myClone and myClone.Parent then
- frameIndex = 1
- else
- if replayConnection then replayConnection:Disconnect(); replayConnection = nil end
- isReplaying = false
- spawnClone()
- updateGUI()
- end
- end
- end)
- end
- local function startRecording()
- if isRecording or isReplaying then
- updateStatus("Busy!", Color3.fromRGB(220, 100, 100))
- return
- end
- character = player.Character
- if not character then
- updateStatus("No character!", Color3.fromRGB(220, 100, 100))
- return
- end
- playerBodyParts = {}
- for _, n in ipairs(bodyPartNames) do
- local p = character:FindFirstChild(n)
- if p then table.insert(playerBodyParts, p) end
- end
- if #playerBodyParts == 0 then
- updateStatus("No body parts!", Color3.fromRGB(220, 100, 100))
- return
- end
- isRecording = true; recordedFrames = {}
- recordConnection = RunService.RenderStepped:Connect(function()
- local f = {}
- for _, p in ipairs(playerBodyParts) do
- if p and p.Parent then
- f[p.Name] = {CFrame = p.CFrame}
- end
- end
- table.insert(recordedFrames, f)
- updateGUI()
- end)
- updateStatus("Recording...", Color3.fromRGB(220, 80, 80))
- end
- UserInputService.InputBegan:Connect(function(input, processed)
- if processed then return end
- if input.KeyCode == RECORD_KEY then
- if isRecording then
- isRecording = false
- if recordConnection then recordConnection:Disconnect() end
- updateStatus("Recording stopped", Color3.fromRGB(100, 200, 100))
- else
- startRecording()
- end
- elseif input.KeyCode == REPLAY_KEY then
- replayOnClone()
- elseif input.KeyCode == RESPAWN_KEY then
- spawnClone()
- updateStatus("Clone spawned", Color3.fromRGB(100, 160, 220))
- end
- end)
- spawnClone()
- refreshFileList()
- -- Show GUI initially
- gui.Enabled = true
Advertisement
Add Comment
Please, Sign In to add comment