# Roblox Asset Manager

The Windows app downloads **accessible** animation, audio, or mesh content by Roblox asset ID and publishes it as a new asset through Roblox Open Cloud. The Studio Bridge plugin scans the place, sends references to the app on this PC, and applies new IDs after upload. Reupload only content you have permission to republish. Private or restricted assets that Roblox does not deliver cannot be copied with this tool.

## Windows app and Studio bridge

1. Run [RobloxAssetManager.exe](RobloxAssetManager.exe). The app listens only on `127.0.0.1:8765` and generates a random bridge token each run.
2. Create a new Script in Studio, paste in [StudioAssetBridge.lua](StudioAssetBridge.lua), right-click the Script and choose **Save as Local Plugin**.
3. Open **Plugins → Asset Bridge**. Copy the token shown in the Windows app into the plugin. Studio may ask to allow HTTP requests to localhost.
4. Choose whole place or selected objects, then click **Scan and send to desktop**. The scan includes animation, sound, mesh, StringValue, string attributes, common image properties, and asset IDs in scripts. IDs with unknown asset type appear as `unknown`; add them manually in the app with the right type before uploading. Booleans cannot contain asset IDs.
5. In the app, enter a Roblox Open Cloud API key with `asset:write`, and the user or group ID that should own the new uploads. Select rows and click **Preview selected**, then **Upload selected**. No key or cookie is saved to disk or sent to the website.
6. In Studio, click **Pull completed uploads**, review the mappings, then **Apply pulled mappings in Studio**. Studio records an Undo operation. Check changed scripts and MeshPart collision and appearance before publishing your place.

The optional cookie field is for assets your logged-in Roblox account can access and for follow checks; it is sent only to Roblox and stays in memory. The Open Cloud API key handles uploads. The site at `nichegames.lol/asset-manager.html` serves downloads and instructions; uploads run locally.

Script scanning recognizes `rbxassetid://…`, Roblox asset URLs, and quoted IDs assigned to fields such as `AnimationId`, `SoundId`, and `MeshId`. It does not attempt to interpret every number in arbitrary Luau code. Generic string properties are limited to common asset fields, `StringValue`, and string attributes because Studio plugins cannot enumerate every property of every class. The plugin also does not edit package contents.

## Follow check

The app can check whether one user follows another. Enter numeric follower and target user IDs and a Roblox session cookie, then click **Check**. The optional upload gate checks the signed-in cookie account against the target ID. This is a desktop convenience gate; it is not a secure reward system for a published Roblox game. The follow-for-reward feature can be designed separately.

## Command line alternative

Requires Python 3.10+ and a Roblox Open Cloud API key with the `asset:write` permission. The key's account must be allowed to publish to the specified user or group. No Roblox browser cookie is needed. Set the key in the `ROBLOX_API_KEY` environment variable before uploading.

In PowerShell, preview an asset first:

```powershell
python reupload_roblox_assets.py --type animation --ids 507771019 --user-id YOUR_USER_ID
```

The preview downloads and checks the source format, but makes no upload. To create new assets:

```powershell
$secret = Read-Host "Roblox API key" -AsSecureString
$env:ROBLOX_API_KEY = [System.Net.NetworkCredential]::new('', $secret).Password
python reupload_roblox_assets.py --type animation --ids OLD_ANIMATION_ID --user-id YOUR_USER_ID --upload
python reupload_roblox_assets.py --type audio --ids OLD_AUDIO_ID_1 OLD_AUDIO_ID_2 --group-id YOUR_GROUP_ID --upload
python reupload_roblox_assets.py --type mesh --ids OLD_MESH_ID --user-id YOUR_USER_ID --upload
Remove-Item Env:ROBLOX_API_KEY
```

Successful uploads are saved as old/new ID pairs in `asset-mapping.json` next to the Python tool (or a path provided with `--output`). Upload requests can fail due to Roblox permissions, moderation, quotas, asset size, or format restrictions. The tool reports the Roblox error for each failed ID. Audio uploads have separate Roblox account limits.

## Manual reference plugin

1. Open [AssetReferenceManager.lua](AssetReferenceManager.lua) and copy its contents into a new **Script** in Roblox Studio.
2. Right-click the Script in Explorer and choose **Save as Local Plugin**.
3. Open **Plugins → Assets** to show the docked manager.

## Replace references in Studio

1. Choose **whole place** or **selection and descendants**, then click **Scan references**.
2. Click a scan result to fill its type and old ID, or enter these yourself.
3. Enter the new asset ID from `asset-mapping.json`. Numeric IDs and `rbxassetid://` URLs are accepted.
4. Click **Preview replacement**, then **Apply replacement**. The change is recorded in Studio's Undo history.
5. For MeshParts whose `MeshId` cannot be read by a plugin, select the MeshParts in Explorer and use **Apply new mesh to selected MeshParts**. This preserves each part's texture ID; check collision and appearance after applying.

The plugin changes instance properties on `Animation`, `Sound`, `SpecialMesh`/`FileMesh`, and supported `MeshPart` instances. It does not rewrite script source or assets embedded in packages. Roblox still requires the new asset to be accessible to the experience.
