Well, I think the problem might be is that you’re trying to get a UserId from a model. You’ll need to get the player object for that. If this is a character of a player, you can use game:GetService(“Players”):GetPlayerFromCharacter(Model), then get the UserId from that.
The UserId is in a value and it is correct because I checked
Try doing print(game.Players:GetCharacterAppearanceInfoAsync(1))
, because the only way I got it to error HTTP 400 is when it was an invalid UserId. I’m not sure what else it could possibly be.
Where should I put that script?
Just type it in the console. If it errors, then it’s not your script’s fault. If it doesn’t error, it probably means the UserId is invalid.
Im guessing in game?
limitlimitlimit
No, it can be in the studio console, as long as HTTP requests are enabled.
It prints:
03:38:51.428 > print(game.Players:GetCharacterAppearanceInfoAsync(1)) - Studio
03:38:51.549 ▼ {
["assets"] = ▶ {...},
["bodyColors"] = ▶ {...},
["defaultPantsApplied"] = false,
["defaultShirtApplied"] = false,
["emotes"] = {},
["playerAvatarType"] = "R15",
["scales"] = ▶ {...}
} - Edit
Hmm. See what happens if you replace the Model.UserId.Value
with just 1
. If it works, it means the userid is definitely invalid.
It errors the script
limitlimitlimit
Can you show me the script with it changed?
local Model = script.Parent
local autoUpd = true
local autoRefreshDuration = 60
local function resetModel()
for i,v in pairs(Model:GetChildren()) do
if v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('Accessory') or v:IsA('ShirtGraphic') then
v:Destroy()
end
end
if Model.Head:findFirstChild('Mesh') then
Model.Head.Mesh:Destroy()
end
end
local function updateModel()
local UserId = 1
local AppModel = game.Players:GetCharacterAppearanceAsync(UserId)
for i,v in pairs(AppModel:GetChildren()) do
if v:IsA('SpecialMesh') or v:IsA('BlockMesh') or v:IsA('CylinderMesh') then
v.Parent = Model.Head
elseif v:IsA('Decal') then
Model.Head.face.Texture = v.Texture
elseif v:IsA('BodyColors') or v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('ShirtGraphic') then
if Model:findFirstChild('Body Colors') then
Model['Body Colors']:Destroy()
end
v.Parent = Model
elseif v:IsA('Accessory') then
v.Parent = Model
v.Handle.CFrame = Model.Head.CFrame * CFrame.new(0, Model.Head.Size.Y / 2, 0) * v.AttachmentPoint:inverse()
end
end
if not Model.Head:FindFirstChild('Mesh') then
local m = Instance.new('SpecialMesh', Model.Head)
m.MeshType = Enum.MeshType.Head
m.Scale = Vector3.new(1.25, 1.25, 1.25)
end
end
updateModel()
if autoUpd then
while wait(autoRefreshDuration) do
resetModel()
updateModel()
end
end
I’m not sure what to say, both functions work fine on my end.
I’m not sure what would be causing this, especially since using the userid 1 worked in console. This is truly peculiar, it shouldn’t have a reason to error. Maybe try testing this from a game server, and see if that changes anything.
Nope doesn’t change anything all the other “eggs” in the game work fine just this one egg that I made but ran on the same system.
Well, unfortunately I have no idea what could be going wrong, especially since it errored when the UserId was 1. Sorry!
Oh ok thanks for the help!
limitlimitlimit