I am creating a custom character loader, and I would like to copy the default character scripts (Animate, Health, Sound) into the character model. Is there a path to these scripts that I can access programmatically so that I can clone them?
(I realize that I can copy and paste these scripts via Studio, but I would rather access the scripts programmatically so that I always have the most up to date versions of each script.)
I don’t think so. They come with the default character model. I would copy the scripts from a character in a running game and put them in storage to clone.
If you make use of StarterCharacter functionality (add a model called StarterCharacter under StarterPlayer) then it should automatically copy over the latest version of the scripts every time the character spawns with that rig. You also get simplified character spawning for free (works through LoadCharacter and normal spawning behavior).
If it’s not possible to use StarterCharacter (for example because the structure (not appearance) of your rig is different between players or isn’t always the same) then there is unfortunately no way to do this other than hardcoding a version of these scripts.
Okay, thank you for the information. I cannot use StarterCharacter since I need two different character models (such as a knight model, and a wizard model). For each player, my custom loader assigns player.Character to a clone of one of these custom character models.
As far as I know, without forking these scripts or allowing them to get added automatically, you can’t access a path to the scripts which you can ensure will always fetch the latest copies. You’ll have to manually add the scripts in or rethink your design a little to accommodate for these scripts.
This may be the more adventurous route, and you know how adventures are(long and complicated) but you could have the character load in first get the items you need then build a new rig from attachments. In regards to the title and description your best bet would be to just to play test, copy your character in workspace then quit place test then paste into workspace upload the model to your models and frequently update(could also make yourself a custom plug in that retrieves it for you.)
That amounts to hard coding it, which doesn’t solve OP’s problem. They’re asking how to get the default scripts and have them automatically update, which there isn’t a way to do this aside from if you allow the backend engine to add the scripts to the character manually.
Uploading a model still requires manual updates when new versions of character scripts are live. The same goes for a plugin, except plugins don’t run on live games.
what I meant by making a plug in would be that he could click it(would grab the character and get the animate script) and delete the current. I don’t think there is a way to necessarily get it all done automatically, that there still has to be some for of manual use.
That’s why I said it doesn’t solve OP’s question. They’re looking for an automated solution. There is no automated solution available for this. Anything involving a Roblox-inserted script should either be left as-is. The only other alternative is forking the script which requires manual updating.
The plugin wouldn’t be of much help either. The plugin doesn’t have a way to fetch Roblox-inserted scripts without going through a directory or having a path to access it from in the first place. If a plugin could pull the scripts out of a folder, OP would use it for scripts and it’d solve the issue. Neither can do so.
They’re also looking to use this feature at run time, hence why a plugin would not work.
yeah, so basically screwed there. I don’t think they update the animate script that much anyway. Not enough for there to need an automated way for this anyway.