local Heartbeat = game:GetService(“RunService”).Heartbeat
function CalculateSize(Value)
return math.floor(((math.floor(Value)-5)/3)-4)
end
function CountTake()
return #script.Parent.ClothesPage.List:GetChildren()+2
end
function CalculateLength()
local value = CountTake()
local HowMany = 0
repeat
if value >= 3 then
value -= 3
HowMany += 1
end
until value < 3
return HowMany
end
function CountTake2()
return #script.Parent.AccessorysPage.List:GetChildren()+2
end
function CalculateLength2()
local value = CountTake2()
local HowMany = 0
repeat
if value >= 3 then
value -= 3
HowMany += 1
end
until value < 3
return HowMany
end
local TAT = CalculateSize(script.Parent.ClothesPage.AbsoluteSize.X)
script.Parent.ClothesPage.List.ChildAdded:Connect(function()
local TAT = CalculateSize(script.Parent.ClothesPage.AbsoluteSize.X)
script.Parent.ClothesPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
script.Parent.ClothesPage.List.CanvasSize = UDim2.new(0,0,0,((TAT+4)*CalculateLength())-4)
script.Parent.AccessorysPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
end)
script.Parent.ClothesPage.List.ChildRemoved:Connect(function()
local TAT = CalculateSize(script.Parent.ClothesPage.AbsoluteSize.X)
script.Parent.ClothesPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
script.Parent.ClothesPage.List.CanvasSize = UDim2.new(0,0,0,((TAT+4)*CalculateLength())-4)
script.Parent.AccessorysPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
end)
game.Workspace.Camera:GetPropertyChangedSignal(“ViewportSize”):connect(function()
local TAT = CalculateSize(script.Parent.ClothesPage.AbsoluteSize.X)
script.Parent.ClothesPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
script.Parent.ClothesPage.List.CanvasSize = UDim2.new(0,0,0,((TAT+4)*CalculateLength())-4)
script.Parent.AccessorysPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
end)
script.Parent.AccessorysPage.List.ChildAdded:Connect(function()
local TAT = CalculateSize(script.Parent.AccessorysPage.AbsoluteSize.X)
script.Parent.AccessorysPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
script.Parent.AccessorysPage.List.CanvasSize = UDim2.new(0,0,0,((TAT+4)CalculateLength2())-4)
end)
script.Parent.AccessorysPage.List.ChildRemoved:Connect(function()
local TAT = CalculateSize(script.Parent.AccessorysPage.AbsoluteSize.X)
script.Parent.AccessorysPage.List.UIGridLayout.CellSize = UDim2.new(0,TAT,0,TAT)
script.Parent.AccessorysPage.List.CanvasSize = UDim2.new(0,0,0,TAT((TAT+4)*CalculateLength2())-4)
end)
local function Add3D(Character,RRS)
print(“”)
local Model = Instance.new(“Model”,Character)
Model.Name = “D3Clothing”
for index,value in RRS:GetChildren() do
if value.ClassName ~= “Shirt” and value.ClassName ~= “Pants” then
local copy = value:Clone()
copy.Parent = Model
local weld = copy:FindFirstChildOfClass(“Weld”)
weld.Part1 = Character[weld.Name]
local OriginC0 = weld.C0
local function AAAA()
copy.CFrame = Character[weld.Name].CFrame * OriginC0
if weld.Name:split(“Head”)[2] == nil then
copy.Size = Vector3.new(
value.Size.XCharacter.Humanoid.BodyWidthScale.Value,
value.Size.YCharacter.Humanoid.BodyHeightScale.Value,
value.Size.Z*Character.Humanoid.BodyDepthScale.Value
)
–[[
weld.C0 = CFrame.new(
OriginC0.Position.X*Character.Humanoid.BodyWidthScale.Value,
OriginC0.Position.Y*Character.Humanoid.BodyHeightScale.Value,
OriginC0.Position.Z*Character.Humanoid.BodyDepthScale.Value
)
]]--
end
end
AAAA()
Character[weld.Name]:GetPropertyChangedSignal("Size"):Connect(AAAA)
else
if value.ClassName == "Shirt" then
Character.Shirt.ShirtTemplate = value.ShirtTemplate
else
Character.Pants.PantsTemplate = value.PantsTemplate
end
end
end
for index,value in RRS:GetAttributes() do
if index == "Handle" then
Character.Hair.Handle.Transparency = value
else
Character[index].Transparency = value
end
end
end
function CreateAll()
coroutine.wrap(function()
if script.Parent.Parent.Parent.Parent.Character.Visible == true then
script.RemoteEvent:FireServer(script.Parent.AccessorysPage.List)
end
end)()
for _,c in game.Players.LocalPlayer.Outfits:GetChildren() do
if script.Parent.Parent.Parent.Parent.Character.Visible == true then
Heartbeat:Wait()
if not game.ReplicatedStorage.D3Clothes:FindFirstChild(c.Name) then
local frame = script.Frame:Clone()
frame.Name = c.Name
frame.Parent = script.Parent.ClothesPage.List
if game.ReplicatedStorage.Outfits:FindFirstChild(“Outfit”…c.Name) then
frame.ViewportFrame.Dummy.Pants.PantsTemplate = game.ReplicatedStorage.Outfits[“Outfit”…c.Name].Pants.PantsTemplate
frame.ViewportFrame.Dummy.Shirt.ShirtTemplate = game.ReplicatedStorage.Outfits[“Outfit”…c.Name].Shirt.ShirtTemplate
elseif game.ReplicatedStorage.VadosShop.Outfits:FindFirstChild(c.Name) then
frame.ViewportFrame.Dummy.Pants.PantsTemplate = game.ReplicatedStorage.VadosShop.Outfits[c.Name].Pants.PantsTemplate
frame.ViewportFrame.Dummy.Shirt.ShirtTemplate = game.ReplicatedStorage.VadosShop.Outfits[c.Name].Shirt.ShirtTemplate
end
frame.BuyBtn.Shirt.MouseButton1Down:connect(function()
script.Clothes:InvokeServer(c.Name,“Shirt”)
end)
frame.BuyBtn.Pants.MouseButton1Down:connect(function()
script.Clothes:InvokeServer(c.Name,“Pants”)
end)
else
local frame = script.FrameR15:Clone()
frame.Name = c.Name
frame.Parent = script.Parent.ClothesPage.List
frame.BuyBtn.Shirt.MouseButton1Down:connect(function()
script.Clothes:InvokeServer(c.Name,“Shirt”)
end)
frame.BuyBtn.Pants.MouseButton1Down:connect(function()
script.Clothes:InvokeServer(c.Name,“Pants”)
end)
Add3D(frame.ViewportFrame.Dummy,
game.ReplicatedStorage.D3Clothes:FindFirstChild(c.Name)
)
end
else
break
end
end
end
function CleanAll()
for _,c in pairs(script.Parent.ClothesPage.List:GetChildren()) do
if c.Name ~= “UIGridLayout” then
c:Destroy()
end
end
script.Clear:FireServer()
end
if script.Parent.Parent.Parent.Parent.Character.Visible == true then
CreateAll()
else
CleanAll()
end
script.Parent.Parent.Parent.Parent.Character.Changed:Connect(function()
if script.Parent.Parent.Parent.Parent.Character.Visible == true then
CreateAll()
else
CleanAll()
end
end)