Using AssetURL returned "Unable to cast string to int64"

Explanation

So, I have a problem with my script. I’ve searched the depths of the forum for an answer but nothing. What I am trying to do it create a script to change the player’s shirt and pants ID using AssetURL because of the CatalogID and TemplateID situation. Why did Roblox do that anyways? It just makes it more confusing than it needs to. Anyways, when I tested the game it returned “Unable to cast string to int64” I need help figuring this out. I’m still a little new to Roblox Studio.

Problem

Here is the line from my script I created. What do you think is wrong?

AssetURL = game:GetService("InsertService"):LoadAsset("https://www.roblox.com/catalog/14318099395/Rebel")

print(AssetURL)

-- I also tried using this to insert a model with it. That failed even worse.

I have completely tried everything. I also tried using print(tonumber(AssetURL)).

Take a look at the parameters InsertService:LoadAsset takes:

You’re passing a string (the URL, to be exact), which is not what the function expects so it throws an error. You should pass the ID as a number.

1 Like

Thanks! I just found a way to do it but, I might use this for other games if needed.

1 Like

So, I just used a morph that uses the catalog ID. It works amazing. Thank you anyways.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.