Advertisement
mewishmeww

hum exp

Jan 27th, 2025 (edited)
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.77 KB | None | 0 0
  1. local HttpService = game:GetService("HttpService")
  2.  
  3. -- Function to serialize a CFrame
  4. local function serializeCFrame(cframe)
  5.     local components = { cframe:GetComponents() }
  6.     return {
  7.         X = components[1],
  8.         Y = components[2],
  9.         Z = components[3],
  10.         R00 = components[4], R01 = components[5], R02 = components[6],
  11.         R10 = components[7], R11 = components[8], R12 = components[9],
  12.         R20 = components[10], R21 = components[11], R22 = components[12]
  13.     }
  14. end
  15.  
  16. -- Function to serialize a rig
  17. local function serializeRig(rig)
  18.     local serialized = {}
  19.  
  20.     local function recurse(part)
  21.         local data = {
  22.             Name = part.Name;
  23.             ClassName = part.ClassName;
  24.             ParentName = part.Parent and part.Parent.Name or nil;
  25.             Properties = {};
  26.             Attributes = {};
  27.         }
  28.  
  29.         -- Serialize BasePart properties
  30.         if part:IsA("BasePart") then
  31.             data.Properties.CFrame = serializeCFrame(part.CFrame)
  32.             data.Properties.Size = { X = part.Size.X, Y = part.Size.Y, Z = part.Size.Z }
  33.             data.Properties.CanCollide = part.CanCollide
  34.             data.Properties.Anchored = part.Anchored
  35.             data.Properties.Material = part.Material.Value
  36.             data.Properties.Transparency = part.Transparency
  37.             if not part:IsA("MeshPart") and not part:IsA("UnionOperation") and not part:IsA("PartOperation") and not part:IsA("NegateOperation") and not part:IsA("IntersectOperation") and not part:IsA("WedgePart") and not part:IsA("TrussPart") and not part:IsA("CornerWedgePart") then
  38.                 data.Properties.Shape = part.Shape.Value
  39.             end
  40.             data.Properties.Color = { R = part.Color.R, G = part.Color.G, B = part.Color.B }
  41.         end
  42.  
  43.         -- Serialize MeshPart properties
  44.         if part:IsA("MeshPart") then
  45.             data.Properties.MeshId = part.MeshId
  46.             data.Properties.TextureId = part.TextureID
  47.             data.Properties.RenderFidelity = part.RenderFidelity.Value
  48.         end
  49.  
  50.         -- Serialize Motor6D properties
  51.         if part:IsA("Weld") or part:IsA("Motor6D") then
  52.             data.Properties.C0 = serializeCFrame(part.C0)
  53.             data.Properties.C1 = serializeCFrame(part.C1)
  54.             data.Properties.Part0 = part.Part0 and part.Part0.Name or nil
  55.             data.Properties.Part1 = part.Part1 and part.Part1.Name or nil
  56.         end
  57.  
  58.         -- Serialize Humanoid properties
  59.         if part:IsA("Humanoid") then
  60.             data.Properties.Health = part.Health
  61.             data.Properties.MaxHealth = part.MaxHealth
  62.             data.Properties.WalkSpeed = part.WalkSpeed
  63.             data.Properties.JumpPower = part.JumpPower
  64.             data.Properties.HipHeight = part.HipHeight
  65.             data.Properties.EvaluateStateMachine = part.EvaluateStateMachine
  66.             data.Properties.RequiresNeck = part.RequiresNeck
  67.             data.Properties.AutoRotate = part.AutoRotate
  68.             data.Properties.AutomaticScalingEnabled = part.AutomaticScalingEnabled
  69.             data.Properties.AutoJumpEnabled = part.AutoJumpEnabled
  70.             data.Properties.MaxSlopeAngle = part.MaxSlopeAngle
  71.             data.Properties.BreakJointsOnDeath = part.BreakJointsOnDeath
  72.         end
  73.  
  74.         if part:IsA("Attachment") then
  75.             data.Properties.CFrame = serializeCFrame(part.CFrame)
  76.         end
  77.  
  78.         if part:IsA("Decal") then
  79.             data.Properties.Texture = part.Texture
  80.             data.Properties.Transparency = part.Transparency
  81.             data.Properties.Color3 = { R = part.Color3.R, G = part.Color3.G, B = part.Color3.B }
  82.             data.Properties.ZIndex = part.ZIndex
  83.         end
  84.  
  85.         if part:IsA("SpecialMesh") then
  86.             data.Properties.MeshId = part.MeshId or ""
  87.             data.Properties.MeshType = part.MeshType or "Head"
  88.             data.Properties.Offset = { X = part.Offset.X, Y = part.Offset.Y, Z = part.Offset.Z }
  89.             data.Properties.Scale = { X = part.Scale.X, Y = part.Scale.Y, Z = part.Scale.Z }
  90.             data.Properties.VertexColor = { X = part.VertexColor.X, Y = part.VertexColor.Y, Z = part.VertexColor.Z }
  91.             data.Properties.TextureId = part.TextureId or ""
  92.         end
  93.  
  94.         if part:GetAttributes() then
  95.             for name,value in pairs(part:GetAttributes()) do
  96.                 if name and value then
  97.                     pcall(function()
  98.                         print(name,value)
  99.                         data.Attributes[name] = value
  100.                     end)
  101.                 end
  102.             end
  103.         end
  104.  
  105.         -- Recurse into children
  106.         data.Children = {}
  107.         for _, child in ipairs(part:GetChildren()) do
  108.             table.insert(data.Children, recurse(child))
  109.         end
  110.  
  111.         return data
  112.     end
  113.  
  114.     table.insert(serialized, recurse(rig))
  115.     return HttpService:JSONEncode(serialized)
  116. end
  117.  
  118. -- GUI setup
  119. local screenGui = Instance.new("ScreenGui")
  120. local textBox = Instance.new("TextBox")
  121.  
  122. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  123. screenGui.Name = "RigExporter"
  124.  
  125. textBox.Size = UDim2.new(0.8, 0, 0.4, 0)
  126. textBox.Position = UDim2.new(0.1, 0, 0.3, 0)
  127. textBox.TextScaled = true
  128. textBox.TextWrapped = true
  129. textBox.ClearTextOnFocus = false
  130. textBox.PlaceholderText = "Exported Rig Data"
  131. textBox.Text = ""
  132. textBox.Parent = screenGui
  133.  
  134. local model = game.Workspace:FindFirstChild("Neon Arcade")
  135. if model then
  136.     setclipboard(tostring(serializeRig(model)))
  137. else
  138.     textBox.Text = "Model not found"
  139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement