Require( assetId, ignoreCache ) or something similar

Would be really useful so we can require the latest version of a module without having to use the insert service to get the latest version. Is possible with InsertService but that doesn’t work if the place owner doesn’t own the module ( require does )

4 Likes

I support this in theory, but why would you want to use a different version of a module in the same server? Possible conflicts?

1 Like

To get the latest version of the module in the case that you want to update the server, and you can easily make sure all events, etc are disconnected before the new module is required.

Would have to be require(assetVersionId,true) as some assetIds and assetVersionIds are the same.

Updated the op

I’d like this feature as well, but as as workaround you can do this,

Instead of
require( 123123123 )

You can do
require( GetAsync( ModuleNameKey ) )

And create a new model every time you want to update the module, then SetAsync the asset ID of the new module and have the require()ing script hooked up to an OnUpdate.

2 Likes

If I made a new model for every update I’d end up with an inventory full of models that I’d have to scroll past when I upload models

You can delete models from your inventory.

You can’t delete them entirely though, like, they still appear in the models list when you upload a model. Or has this changed?

EDIT:
Yeah, you still can’t actually delete them, just ‘untake’ them ( I don’t ‘own’ the red ones yet they still appear in my develop window, etc )

Do this when you want to look at your own models:

I understand that but when you upload a model from studio it displays any that you created, even if you ‘deleted’ them e.g. ( Red ones are models I deleted )

So if I did make a new model for every update it would fill up that screen and make it a pain in the ass to upload models

1 Like

I wasn’t disagreeing with the OP, I was just trying to give a temporary workaround.

Sorry, I know, I didn’t mean to sound like I was arguing with you, I was just letting you know why the workaround isn’t ideal / why I wouldn’t use it

Bump, really need this

What’s your use case? It’s unlikely that this will be implemented if you don’t explain when this would be useful. You can already do this for your own modules using LoadAssetVersion. Using modules required by AssetId made by someone else is an attack vector against your game and you shouldn’t do it, my personal opinion is that we shouldn’t add any more features to support this.

Things like auto updating admin commands, etc

The current way with insertservice requires the asset be owned and requires it be inserted, moved out of the model that its inserted in and then required

This does not seem like a good use case to me, you should not allow any code run in your game unless you have wrote the code yourself or audited the code to make sure it’s ok. Using auto updating admin commands is insane, even if the creator of the commands is not malicious their account can be compromised or they can make an update that conflicts with the existing code in your game and cause bugs.

With the new chat we increased the maximum amount of characters a player could chat from 140 to 200 characters. In a popular admin command script there was a check if a message from a player contained more than 160 characters, if it did it kicked the player from the game. This command script was being used in at least one front page game. You shouldn’t put thousands of lines of code you haven’t read into your game, it’s even worse if it is auto updating.

I think we should probably break require for assetIds the creator doesn’t own, it’s too much of an attack vector against games that use it.

2 Likes

I agree that the person should have to own it, however if that’s implemented I see no reason not to allow us to require the latest version directly as we can already do it with insertservice?

This would ruin require() in script builders, as the owner of the script builder would have to own the module and I prefer my script builder modules closed-source.

If you’re going to implement this change, please add a game configuration option to allow unowned modules.

3 Likes

I have to admit that I like the fact you can use require( ) in any game however it opens up MASSIVE security risks for even FE games which is not good. It basically entirely circumvents the restrictions put on the InsertService…