Im attempting to load a player’s clothing onto a custom character model using LoadAsset. However, when I try to call the server to retrieve the correct ID (instead of the catalog ID for the image), the script execution completely halts, and I can’t figure out why. My RemoteFunction is located in ReplicatedStorage as GetId
Client:
local shirt = id_service:InvokeServer(humanoid_description.Shirt)
local pants = id_service:InvokeServer(humanoid_description.Pants)
apply_clothing(torso, shirt)
apply_clothing(left_arm, shirt)
apply_clothing(right_arm, shirt)
apply_clothing(left_leg, pants)
apply_clothing(right_leg, pants)
Server:
script.Parent.OnServerInvoke = function(id)
local asset:Instance = game:GetService("InsertService"):LoadAsset(id)
if asset:IsA("Pants") then
task.delay(1,function()
asset:Destroy()
end)
return asset.PantsTemplate
elseif asset:IsA("Shirt") then
task.delay(1,function()
asset:Destroy()
end)
return asset.ShirtTemplate
end
end
so yeah, invoking a RemoteFunction will yield the code.
But the issue is here:
Just like a RemoteEvent, the Player object of the client who invoked the RemoteFunction will always be the first parameter. You need to account for that here; the player is pointed to by id and the actual id data is discarded in your current code.
I’ve fixed the player variable not being added but im now realizing it never even properly handles the request, if i put any sort of print on the first line of the invoke it wont print anything??