Can I rename scripts without having any problems?

Can I rename scripts without having any problems? I want to rename my scripts so it’s easier to handle everything because right now everything is a mess and I can’t find the scripts I need to fix etc. Just curious because I’d assume it can start issues if resources are named differently.

1 Like

If the resource is standalone and does not use other resources exports or has exports on her own you can, but all other resources would break if you rename them.

1 Like

also make to check any javascript (.js) files for nui callbacks this might also break your resource if you rename it

2 Likes

The amount of times I have seen people ask for support on the forums for a broken script, but it’s just because they renamed it and didn’t change the JS file…

For reference to anyone that sees this thread, if you are writing something for release, account for the people that want to change it. Or if you are choosing to change it, please remember the JS files!

They will have something like this;

$.post("https://original_name/doSomething");

If you are changing it, you can do this;

$.post("https://new_name/doSomething");

But the best method in my opinion is to do this, even for the original creators;

$.post(`https://${GetParentResourceName()}/doSomething`);

This will allow any name changes to work without editing these post methods.
Note the backticks instead of quotes, allowing you to use variables in a string like this; ${varName}

4 Likes