Hi everyone
In my game I am working on a feature where players can spawn or create custom rigs using an avatar shop interface.
Everything works on the client side but I am unsure about the safest and most efficient way to sanitize and validate the data before applying it on the server.
Currently the client sends a table containing relevant HumanoidDescription
properties for example
{
Accessories = HumanoidDescription:GetAccessories(true),
HumanoidRigType = Selected == R15 and Enum.HumanoidRigType.R15 or Enum.HumanoidRigType.R6,
Scale = {
BodyTypeScale = HumanoidDescription.BodyTypeScale,
ProportionScale = HumanoidDescription.ProportionScale,
HeadScale = HumanoidDescription.HeadScale,
HeightScale = HumanoidDescription.HeightScale,
WidthScale = HumanoidDescription.WidthScale,
DepthScale = HumanoidDescription.DepthScale,
},
BodyColors = {
HeadColor = HumanoidDescription.HeadColor,
TorsoColor = HumanoidDescription.TorsoColor,
LeftArmColor = HumanoidDescription.LeftArmColor,
RightArmColor = HumanoidDescription.RightArmColor,
LeftLegColor = HumanoidDescription.LeftLegColor,
RightLegColor = HumanoidDescription.RightLegColor,
},
BodyParts = {
Head = HumanoidDescription.Head,
Face = HumanoidDescription.Face,
Torso = HumanoidDescription.Torso,
RightArm = HumanoidDescription.RightArm,
LeftArm = HumanoidDescription.LeftArm,
RightLeg = HumanoidDescription.RightLeg,
LeftLeg = HumanoidDescription.LeftLeg,
},
Clothes = {
GraphicTShirt = HumanoidDescription.GraphicTShirt,
Shirt = HumanoidDescription.Shirt,
Pants = HumanoidDescription.Pants,
}
}
The problem is I am not sure what the best approach is for validating this data once it reaches the server
My first idea was to use AvatarEditorService:GetBatchItemDetails to check all asset IDs at once instead of MarketplaceService:GetProductInfo or AvatarEditorService:GetItemDetails repeatedly but I have read that AvatarEditorService:GetBatchItemDetails has strict throttling limits
I also considered using Enum.AssetTypeVerification with Always when applying the description, but during testing I noticed it can occasionally throw errors and it also makes managing accessory refinement more difficult.