Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why isn't LoadAsset() working?

I'm making an installer plugin which can install any compatible kit, via use of LoadAsset(), and I'm running into a problem every time I give the plugin an asset id of a kit (in this case a test kit) I get the following error:

15:36:51.737 - Did you forget a colon? The first argument of member function LoadAsset must be an Object 15:36:51.740 - Script 'Plugin_287124029.Installer.InstallerGui.Script', Line 68 15:36:51.741 - Stack End

However the object browser says this:

Instance LoadAsset(int assetId) Member of InsertService Summary: Returns a Model containing the Instance that resides at AssetId on the web. This call will also yield the script until the model is returned. Script execution can still continue, however, if you use a coroutine.

Now my code looks like this:

local IS = game:getService("InsertService")
local MID = S_F:getText() -- S_F is a class that gets stuff for me
kit = IS.LoadAsset(MID)
-- the rest is checks for if it's really a kit

BTW: Can I use :IsA("int") to see if variable data is a int?

2 comments

0

'LoadAsset' isn't a Property; It's a method. :P

0

Yourrrrrrr right, that fixed the issue! But why was I getting that error in the first place, instead of just getting an error saying it's non-existent?

1 answer

✓ Accepted answer

'LoadAsset' isn't a Property; It's a method. :P [2]

local IS = game:getService("InsertService")
local MID = S_F:getText() -- S_F is a class that gets stuff for me
kit = IS:LoadAsset(MID)
-- the rest is checks for if it's really a kit

This discussion is preserved as it was. New answers, comments, and votes are closed.