Advertisement
Not_Infimax

Avatar Client

Mar 30th, 2023
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.63 KB | None | 0 0
  1. local Hairs = require(game.ReplicatedStorage.Catalog.Hair)
  2. local Shirts = require(game.ReplicatedStorage.Catalog.Shirts)
  3. local Face = require(game.ReplicatedStorage.Catalog.Faces)
  4. local Pants = require(game.ReplicatedStorage.Catalog.Pants)
  5.  
  6. plr = game.Players.LocalPlayer
  7. char = plr.Character or plr.CharacterAdded:Wait()
  8.  
  9. local Editor = plr.PlayerGui.AvatarEditor
  10. Frame = Editor.Background.ScrollFrame
  11.  
  12. MSS = game:GetService("MarketplaceService")
  13.  
  14.  
  15. local function AddUiGridLayout()
  16.     local Grid = script:WaitForChild("UIGridLayout")
  17.     Grid = Grid:Clone()
  18.     Grid.Parent = Frame
  19. end
  20.  
  21. local function ClearNillClothes()
  22.     for i,v in pairs(Frame:GetChildren()) do
  23.         if v:IsA("ImageLabel") and v.ClothingImage.IsLoaded == false then
  24.             v:Destroy()
  25.         end
  26.     end
  27. end
  28.  
  29.  
  30.  
  31. Event = game.ReplicatedStorage.AvatarEvent
  32.  
  33. char.Humanoid.Died:Connect(function()
  34.     local Description = char.Humanoid:GetAccessories()
  35.     Event:FireServer("Respawned",Description)
  36. end)
  37. local Camera = workspace.CurrentCamera
  38.  
  39. Editor.Background.Hair.MouseButton1Click:Connect(function()
  40.     Frame:ClearAllChildren()
  41.     AddUiGridLayout()
  42.     for i,v in pairs(Hairs) do
  43.         local Asset = MSS:GetProductInfo(v.ID,Enum.InfoType.Asset)
  44.         if Asset.IsForSale == false then
  45.             warn("Deleted Asset")
  46.         else
  47.             Button = script:WaitForChild("Button"):Clone()
  48.             Button.Parent = Frame
  49.             Button:WaitForChild("ClothingImage").Image = "https://www.roblox.com/asset-thumbnail/image?assetId="..v.ID.."&width=420&height=420&format=png"
  50.             Button.Name = v.Name
  51.             Button.ClothingImage.MouseButton1Click:Connect(function()
  52.                 Event:FireServer("Hair",v.ID)
  53.             end)
  54.         end
  55.     end
  56. end)
  57.  
  58. Editor.Background.Shirts.MouseButton1Click:Connect(function()
  59.     Frame:ClearAllChildren()
  60.     AddUiGridLayout()
  61.     for i,v in pairs(Shirts) do
  62.         local Asset = MSS:GetProductInfo(v.ID,Enum.InfoType.Asset)
  63.         if Asset.IsForSale == false then
  64.             warn("Deleted Asset")
  65.         else
  66.             Button = script:WaitForChild("Button"):Clone()
  67.             Button.Parent = Frame
  68.             Button:WaitForChild("ClothingImage").Image = "https://www.roblox.com/asset-thumbnail/image?assetId="..v.ID.."&width=420&height=420&format=png"
  69.             Button.Name = v.Name
  70.             Button.ClothingImage.MouseButton1Click:Connect(function()
  71.                 Event:FireServer("Shirt",v.ID)
  72.             end)
  73.         end
  74.     end
  75. end)
  76.  
  77. Editor.Background.Face.MouseButton1Click:Connect(function()
  78.     Frame:ClearAllChildren()
  79.     AddUiGridLayout()
  80.     for i,v in pairs(Face) do
  81.         local Asset = MSS:GetProductInfo(v.ID,Enum.InfoType.Asset)
  82.         if Asset.IsForSale == false then
  83.             warn("Deleted Asset")
  84.         else
  85.             Button = script:WaitForChild("Button"):Clone()
  86.             Button.Parent = Frame
  87.             Button:WaitForChild("ClothingImage").Image = "https://www.roblox.com/asset-thumbnail/image?assetId="..v.ID.."&width=420&height=420&format=png"
  88.             Button.Name = v.Name
  89.             Button.ClothingImage.MouseButton1Click:Connect(function()
  90.                 Event:FireServer("Face",v.ID)
  91.             end)
  92.         end
  93.     end
  94. end)
  95.  
  96. Editor.Background.Pants.MouseButton1Click:Connect(function()
  97.     Frame:ClearAllChildren()
  98.     AddUiGridLayout()
  99.     for i,v in pairs(Pants) do
  100.         local Asset = MSS:GetProductInfo(v.ID,Enum.InfoType.Asset)
  101.         if Asset.IsForSale == false then
  102.             warn("Deleted Asset")
  103.         else
  104.             Button = script:WaitForChild("Button"):Clone()
  105.             Button.Parent = Frame
  106.             Button:WaitForChild("ClothingImage").Image = "https://www.roblox.com/asset-thumbnail/image?assetId="..v.ID.."&width=420&height=420&format=png"
  107.             Button.Name = v.Name
  108.             Button.ClothingImage.MouseButton1Click:Connect(function()
  109.                 Event:FireServer("Pants",v.ID)
  110.             end)
  111.         end
  112.     end
  113. end)
  114.  
  115.  
  116. Editor.Background.CloseButton.MouseButton1Click:Connect(function()
  117.     Editor.Background:TweenPosition(UDim2.new(0.181, 0,1.34, 0),Enum.EasingDirection.In,Enum.EasingStyle.Linear)
  118.     wait(1)
  119.     Editor.Background.Visible = false
  120.     repeat wait ()
  121.         Camera.CameraType = Enum.CameraType.Custom
  122.     until Camera.CameraType == Enum.CameraType.Custom
  123.     Camera.CameraSubject = char.Humanoid
  124.     Camera.CameraSubject = char.Humanoid
  125.     Camera.CameraType = "Custom"
  126.     Camera.CFrame = char.Head.CFrame
  127.     char.HumanoidRootPart.Anchored = false
  128.     char.Humanoid.JumpPower = 16
  129. end)
  130.  
  131. Editor.AvatarButton.MouseButton1Click:Connect(function()
  132.     Editor.Background.Visible = true
  133.     Editor.Background:TweenPosition(UDim2.new(0.194, 0,0.5, 0),Enum.EasingDirection.In,Enum.EasingStyle.Linear)
  134.     Camera.Focus = CFrame.lookAt(char:WaitForChild("HumanoidRootPart").Position,Camera.CFrame.Position - Vector3.new(0,0,-5))
  135.     Camera.CFrame = CFrame.lookAt(char:WaitForChild("HumanoidRootPart").Position,Camera.CFrame.Position - Vector3.new(0,0,-5))
  136.     Camera.CameraSubject = char:WaitForChild("Head")
  137.     char.HumanoidRootPart.Anchored = true
  138.     char.Humanoid.JumpPower = 0
  139. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement