Skip to content

Commit b7c0012

Browse files
General Iteration #2 (#974)
## Changes Some pages have pairs and ipairs creeping back in or that were missed in my previous PR for general iteration. This PR changes them to general iteration. Will update other pages in the future to further remove references to pairs and ipairs however that work is out of scope for this PR as it will be a larger change to the docs. ## Checks By submitting your pull request for review, you agree to the following: - [X] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [X] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [X] To the best of my knowledge, all proposed changes are accurate. --------- Co-authored-by: IgnisRBX <[email protected]>
1 parent d5b0881 commit b7c0012

File tree

2 files changed

+85
-83
lines changed

2 files changed

+85
-83
lines changed

content/en-us/projects/transferring-animations.md

Lines changed: 81 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ title: Transferring Roblox Animations
33
description: Transfer animations when you transfer your experience to a new group owner.
44
---
55

6-
<Alert severity="info">
6+
<Alert severity="warning">
77
The instructions on this page make use of a third-party tool. Roblox does not officially support this tool and is not responsible for its availability, updates, or functionality.
88
</Alert>
99

1010
In Roblox, animations are locked to experiences owned by users who also own those animations. To prevent animations from breaking when you transfer your experience to a group, you must publish your animation assets to the new experience group owner.
1111

12-
If you have a large number of animations to upload, you can use the community-supported tool [Roblox Animation Transfer](https://github.com/evaera/roblox-animation-transfer) to re-upload the animations and map their old `AnimationIds` to their new corresponding `AnimationIds`.
12+
If you have a large number of animations to upload, you can use the community-supported tool [Roblox Animation Transfer](https://github.com/evaera/roblox-animation-transfer) to re-upload the animations and map their old `Class.Animation.AnimationId|AnimationIds` to their new corresponding `Class.Animation.AnimationId|AnimationIds`.
1313

1414
## Prerequisites
1515

@@ -19,33 +19,35 @@ For more information about prerequisites, see the [Roblox Animation Transfer REA
1919

2020
## Mapping AnimationIds to Names
2121

22-
If your animations are stored as Animation instances under pre-prepared Character models in your experience, you can generate a text file to map the `AnimationIds` to their corresponding names.
22+
If your animations are stored as Animation instances under pre-prepared Character models in your experience, you can generate a text file to map the `Class.Animation.AnimationId|AnimationIds` to their corresponding names.
2323

2424
1. In Roblox Studio, run the following script. Studio outputs the result as a single long string.
2525

26-
```lua
27-
local ANIMSTRING = ""
28-
29-
for _, character in pairs(workspace:GetChildren()) do
30-
if not character:IsA("Model") then
31-
continue
32-
end
33-
34-
local animations = character:FindFirstChild("Animations")
35-
if not animations then
36-
continue
37-
end
38-
39-
for _, animation in pairs(animations:GetChildren()) do
40-
local animationId = string.match(animation.AnimationId, "%d+")
41-
if animationId then
42-
ANIMSTRING ..= (animationId .. " " .. character.Name .. "_" .. string.gsub(animation.Name, " ", "_") .. "\n")
26+
```lua
27+
local Workspace = game:GetService("Workspace")
28+
29+
local ANIMSTRING = ""
30+
31+
for _, character in Workspace:GetChildren() do
32+
if not character:IsA("Model") then
33+
continue
4334
end
44-
end
45-
end
46-
47-
print(ANIMSTRING)
48-
```
35+
36+
local animations = character:FindFirstChild("Animations")
37+
if not animations then
38+
continue
39+
end
40+
41+
for _, animation in animations:GetChildren() do
42+
local animationId = string.match(animation.AnimationId, "%d+")
43+
if animationId then
44+
ANIMSTRING ..= (animationId .. " " .. character.Name .. "_" .. string.gsub(animation.Name, " ", "_") .. "\n")
45+
end
46+
end
47+
end
48+
49+
print(ANIMSTRING)
50+
```
4951

5052
2. Create a new text file on your computer.
5153
3. Paste the string output by Studio into the text file.
@@ -81,68 +83,68 @@ After transferring your animations to the new group owner, you must swap the old
8183
2. Create two child modules, one corresponding to the user, or the original owner, and the other corresponding to the group, or the new owner.
8284
3. To prevent the experience from breaking if you choose to publish it to another location, run the following script. By default, the script returns the user's animations.
8385

84-
```lua
85-
local module = {}
86-
local GROUP_ID = 12345678
87-
local gameContext = {
88-
["User"] = require(script:WaitForChild("Animations_User")),
89-
["Group"] = require(script:WaitForChild("Animations_Group"))
90-
}
91-
92-
local function getAnimationMapForGameContext()
93-
if game.CreatorType == Enum.CreatorType.Group and game.CreatorId == GROUP_ID then
94-
return gameContext.Group
86+
```lua
87+
local module = {}
88+
local GROUP_ID = 12345678
89+
local gameContext = {
90+
["User"] = require(script:WaitForChild("Animations_User")),
91+
["Group"] = require(script:WaitForChild("Animations_Group"))
92+
}
93+
94+
local function getAnimationMapForGameContext()
95+
if game.CreatorType == Enum.CreatorType.Group and game.CreatorId == GROUP_ID then
96+
return gameContext.Group
97+
end
98+
return gameContext.User
9599
end
96-
return gameContext.User
97-
end
98-
99-
local animationMap = getAnimationMapForGameContext()
100-
function module.getAnimation(animName: string)
101-
return animationMap[animName]
102-
end
103-
104-
return module
105-
```
100+
101+
local animationMap = getAnimationMapForGameContext()
102+
function module.getAnimation(animName: string)
103+
return animationMap[animName]
104+
end
105+
106+
return module
107+
```
106108

107109
4. Turn the generated text files into animation maps in Studio.
108110
1. Replace the animation list inside the `animFileText` variable with the contents of the text file that you want to change into an animation map.
109111
2. Run the following script to return a string:
110112

111-
```lua
112-
local animFileText = [[
113-
4215167 Animation_Name_1
114-
6171235 Animation_Name_2
115-
1251267 Animation_Name_3
116-
]]
117-
118-
local function convertFileToAnimationMap(animFileText: string)
119-
local NEW_ANIMATION_MAP = ""
120-
121-
local lines = string.split(animFileText, "\n")
122-
for _, line in pairs(lines) do
123-
local components = string.split(line, " ")
124-
if #components ~= 2 then
125-
continue
113+
```lua
114+
local animFileText = [[
115+
4215167 Animation_Name_1
116+
6171235 Animation_Name_2
117+
1251267 Animation_Name_3
118+
]]
119+
120+
local function convertFileToAnimationMap(animFileText: string)
121+
local NEW_ANIMATION_MAP = ""
122+
123+
local lines = string.split(animFileText, "\n")
124+
for _, line in lines do
125+
local components = string.split(line, " ")
126+
if #components ~= 2 then
127+
continue
128+
end
129+
130+
local animationId = components[1]
131+
local animationName = components[2]
132+
133+
NEW_ANIMATION_MAP = string.format("%s\t[\"%s\"] = \"rbxassetid://%s\",\n", NEW_ANIMATION_MAP, animationName, animationId)
126134
end
127-
128-
local animationId = components[1]
129-
local animationName = components[2]
130-
131-
NEW_ANIMATION_MAP = string.format("%s\t[\"%s\"] = \"rbxassetid://%s\",\n", NEW_ANIMATION_MAP, animationName, animationId)
135+
136+
return string.format("return {\n%s}", NEW_ANIMATION_MAP)
132137
end
138+
139+
print(convertFileToAnimationMap(animFileText))
140+
```
133141

134-
return string.format("return {\n%s}", NEW_ANIMATION_MAP)
135-
end
136-
137-
print(convertFileToAnimationMap(animFileText))
138-
```
139-
140-
5. Create a new `ModuleScript` parented to your `Animations` module.
141-
6. Place the returned `animFileText` string inside the `ModuleScript`.
142+
5. Create a new `Class.ModuleScript` parented to your `Animations` module.
143+
6. Place the returned `animFileText` string inside the `Class.ModuleScript`.
142144
7. Update the experience to source all animations through the `Animations` module by running the following script:
143145

144-
```lua
145-
local Animations = require(PATH.TO.ANIMATIONS)
146-
local warriorWalk = Instance.new("Animation")
147-
warriorWalk.AnimationId = Animations.getAnimation("Warrior_Walk")
148-
```
146+
```lua
147+
local Animations = require(PATH.TO.ANIMATIONS)
148+
local warriorWalk = Instance.new("Animation")
149+
warriorWalk.AnimationId = Animations.getAnimation("Warrior_Walk")
150+
```

content/en-us/resources/feature-packages/bundles.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ end
122122

123123
local function initializePurchaseHandlers()
124124
local bundles = Bundles.getBundles()
125-
for bundleId, bundle in pairs(bundles) do
125+
for bundleId, bundle in bundles do
126126
-- Bundle is not associated with a developer product if it does not have marketplace price type
127127
if not bundle or bundle.pricing.priceType ~= "Marketplace" then
128128
continue
@@ -133,7 +133,7 @@ local function initializePurchaseHandlers()
133133
end
134134

135135
-- If you have any in-experience currencies that you are using for bundles, set the handler here
136-
for currencyId, _ in pairs(Currencies) do
136+
for currencyId, _ in Currencies do
137137
Bundles.setInExperiencePurchaseHandler(currencyId, awardInExperiencePurchase)
138138
end
139139
end
@@ -286,7 +286,7 @@ You mainly need to hook up four things once dragging the **Bundles** feature pac
286286

287287
local function initializePurchaseHandlers()
288288
local bundles = Bundles.getBundles()
289-
for bundleId, bundle in pairs(bundles) do
289+
for bundleId, bundle in bundles do
290290
-- Bundle is not associated with a developer product if it does not have marketplace price type
291291
if not bundle or bundle.pricing.priceType ~= "Marketplace" then
292292
continue
@@ -297,7 +297,7 @@ You mainly need to hook up four things once dragging the **Bundles** feature pac
297297
end
298298

299299
-- If you have any in-experience currencies that you are using for bundles, set the handler here
300-
for currencyId, _ in pairs(Currencies) do
300+
for currencyId, _ in Currencies do
301301
Bundles.setInExperiencePurchaseHandler(currencyId, awardInExperiencePurchase)
302302
end
303303
end

0 commit comments

Comments
 (0)