Skip to content

Commit a0635dc

Browse files
update Open Source Docs from Roblox internal teams
1 parent e42b955 commit a0635dc

File tree

446 files changed

+2493
-2447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

446 files changed

+2493
-2447
lines changed

content/en-us/production/promotion/referral-system.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ To implement a referral system, [set up a referral event](#set-up-a-referral-eve
3939
```lua
4040
function onPlayerAdded(player)
4141

42-
local referredByPlayerId = player:GetJoinData().ReferredByPlayerId
42+
local referredByPlayerId = player:GetJoinData().ReferredByPlayerId
4343

44-
local referrerEvent: RemoteEvent = ReplicatedStorage:FindFirstChild("ReferralReceivedEvent")
45-
referrerEvent:FireClient(player, referredByPlayerId)
44+
local referrerEvent: RemoteEvent = ReplicatedStorage:FindFirstChild("ReferralReceivedEvent")
45+
referrerEvent:FireClient(player, referredByPlayerId)
4646
end
4747

4848
Players.PlayerAdded:Connect(onPlayerAdded)
@@ -159,23 +159,45 @@ You can implement safeguards to prevent players from exploiting the friend refer
159159
- Monitor unusual activity and implement corrective measures like banning users or canceling rewards.
160160

161161
```lua
162-
-- Table to track players who have already been referred
163-
local referredPlayers = {}
162+
local DataStoreService = game:GetService("DataStoreService")
163+
local Players = game:GetService("Players")
164164

165-
function onPlayerAdded(player)
165+
-- Create or get the datastore for referrals
166+
local referralDataStore = DataStoreService:GetDataStore("ReferralDataStore")
167+
168+
-- Function to check and mark referral
169+
local function onPlayerAdded(player)
166170
local joinData = player:GetJoinData()
167171
local referredByPlayerId = joinData.ReferredByPlayerId
168172

169-
-- Check if the player was invited and has not already used a referral
170-
if referredByPlayerId and referredByPlayerId ~= 0 and not referredPlayers[player.UserId] then
171-
-- Mark the player as referred
172-
referredPlayers[player.UserId] = true
173+
-- Load player's referral data
174+
local success, alreadyReferred = pcall(function()
175+
return referralDataStore:GetAsync(tostring(player.UserId))
176+
end)
177+
178+
if not success then
179+
warn("Failed to get referral data for player:", player.UserId)
180+
return
181+
end
173182

183+
if referredByPlayerId and not alreadyReferred then
174184
-- Reward inviter and invitee
175185
rewardReferrer(referredByPlayerId)
176186
rewardInvitee(player)
187+
188+
-- Mark the player as referred in DataStore
189+
local saveSuccess, err = pcall(function()
190+
referralDataStore:SetAsync(tostring(player.UserId), true)
191+
end)
192+
193+
if not saveSuccess then
194+
warn("Failed to save referral status for player:", player.UserId, err)
195+
end
177196
end
178197
end
198+
199+
-- Connect the function to the player joining
200+
Players.PlayerAdded:Connect(onPlayerAdded)
179201
```
180202

181203
## Best practices

content/en-us/reference/engine/classes/Accessory.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ description: |
2121
Note: If there are two matching `Attachments`, the resulting `Class.Weld` is a
2222
child of the Accessory's Handle. This differs from the legacy behavior of Hats
2323
where the Weld is always a child of the Head of the character.
24-
code_samples:
24+
code_samples: []
2525
inherits:
2626
- Accoutrement
2727
tags: []
@@ -37,7 +37,7 @@ properties:
3737
`Class.Humanoid:ApplyDescription()`. If available on the Marketplace, you
3838
can set `Enum.AccessoryType` to categorize the Accessory item (for
3939
example, "Hat" or "Face").
40-
code_samples:
40+
code_samples: []
4141
type: AccessoryType
4242
tags: []
4343
deprecation_message: ''

content/en-us/reference/engine/classes/Accoutrement.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ description: |
2222
accoutrement welds to another part that is massless or one if its parts
2323
otherwise becomes root. This also doesn't apply for the root part, and it has
2424
mass like a normal part.
25-
code_samples:
25+
code_samples: []
2626
inherits:
2727
- Instance
2828
tags: []
@@ -33,7 +33,7 @@ properties:
3333
Sets the offset position of the object on the Player.
3434
description: |
3535
Sets the offset position of the object on the Player.
36-
code_samples:
36+
code_samples: []
3737
type: Vector3
3838
tags:
3939
- Hidden
@@ -55,7 +55,7 @@ properties:
5555
The exact CFrame of the Accoutrement.
5656
description: |
5757
The exact CFrame of the Accoutrement.
58-
code_samples:
58+
code_samples: []
5959
type: CFrame
6060
tags: []
6161
deprecation_message: ''
@@ -75,7 +75,7 @@ properties:
7575
Sets the position of the object on the Player.
7676
description: |
7777
Sets the position of the object on the Player.
78-
code_samples:
78+
code_samples: []
7979
type: Vector3
8080
tags:
8181
- Hidden
@@ -97,7 +97,7 @@ properties:
9797
Sets the offset position of the object on the Player.
9898
description: |
9999
Sets the offset position of the object on the Player.
100-
code_samples:
100+
code_samples: []
101101
type: Vector3
102102
tags:
103103
- Hidden
@@ -119,7 +119,7 @@ properties:
119119
Sets the offset position of the object on the Player.
120120
description: |
121121
Sets the offset position of the object on the Player.
122-
code_samples:
122+
code_samples: []
123123
type: Vector3
124124
tags:
125125
- Hidden

content/en-us/reference/engine/classes/Actor.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description: |
1212
1313
To learn more about using multiple Actors to optimize script performance, see
1414
[Parallel Luau](../../../scripting/multithreading.md).
15-
code_samples:
15+
code_samples: []
1616
inherits:
1717
- Model
1818
tags: []
@@ -43,7 +43,7 @@ methods:
4343
print("Received Greeting Message:", message)
4444
end)
4545
```
46-
code_samples:
46+
code_samples: []
4747
parameters:
4848
- name: topic
4949
type: string
@@ -89,7 +89,7 @@ methods:
8989
print("Received Greeting Message:", message)
9090
end)
9191
```
92-
code_samples:
92+
code_samples: []
9393
parameters:
9494
- name: topic
9595
type: string
@@ -129,7 +129,7 @@ methods:
129129
-- Assume `actor` is a local variable referring to an Actor instance
130130
actor:SendMessage("Greeting", "Hello World")
131131
```
132-
code_samples:
132+
code_samples: []
133133
parameters:
134134
- name: topic
135135
type: string

content/en-us/reference/engine/classes/AdService.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: |
99
of monetization. It has been superseded by
1010
[Immersive Ads](../../../production/monetization/immersive-ads.md) which
1111
should be used instead to serve ad units to visitors of your experience.
12-
code_samples:
12+
code_samples: []
1313
inherits:
1414
- Instance
1515
tags:
@@ -42,7 +42,7 @@ methods:
4242
Show mobile video advertisements.
4343
description: |
4444
Show mobile video advertisements.
45-
code_samples:
45+
code_samples: []
4646
parameters: []
4747
returns:
4848
- type: ()
@@ -105,7 +105,7 @@ events:
105105
Fires when an `Class.AdService` video closes.
106106
description: |
107107
Fires when an `Class.AdService` video closes.
108-
code_samples:
108+
code_samples: []
109109
parameters:
110110
- name: adShown
111111
type: boolean

content/en-us/reference/engine/classes/AdvancedDragger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ summary: |
77
description: |
88
An unfinished advanced variant of the `Class.Dragger` class. Internally, this
99
object is an identical implementation of the Dragger class.
10-
code_samples:
10+
code_samples: []
1111
inherits:
1212
- Instance
1313
tags: []

content/en-us/reference/engine/classes/AlignOrientation.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ description: |
5252
5353
This constraint can use either **one** or **two** attachments in calculating
5454
its goal. See `Class.AlignOrientation.Mode|Mode` for details.
55-
code_samples:
55+
code_samples: []
5656
inherits:
5757
- Constraint
5858
tags: []
@@ -69,7 +69,7 @@ properties:
6969
`Enum.AlignType|PrimaryAxisLookAt`. The constraint will attempt to
7070
maintain the specified relationship, as given by the `Enum.AlignType`, by
7171
applying torques onto the relevant axes.
72-
code_samples:
72+
code_samples: []
7373
type: AlignType
7474
tags: []
7575
deprecation_message: ''
@@ -94,7 +94,7 @@ properties:
9494
`Class.Constraint.Attachment0|Attachment0`. Only used when
9595
`Class.AlignOrientation.Mode|Mode` is set to
9696
`Enum.OrientationAlignmentMode|OneAttachment`.
97-
code_samples:
97+
code_samples: []
9898
type: CFrame
9999
tags: []
100100
deprecation_message: ''
@@ -146,7 +146,7 @@ properties:
146146
as well as `Class.AlignOrientation.MaxTorque|MaxTorque`, are **caps** to
147147
the angular velocity and torque respectively. The actual scale is
148148
determined by `Class.AlignOrientation.Responsiveness|Responsiveness`.
149-
code_samples:
149+
code_samples: []
150150
type: float
151151
tags: []
152152
deprecation_message: ''
@@ -172,7 +172,7 @@ properties:
172172
`Class.AlignOrientation.MaxAngularVelocity|MaxAngularVelocity`, are
173173
**caps** to the torque and angular velocity respectively. The actual scale
174174
is determined by `Class.AlignOrientation.Responsiveness|Responsiveness`.
175-
code_samples:
175+
code_samples: []
176176
type: float
177177
tags: []
178178
deprecation_message: ''
@@ -211,7 +211,7 @@ properties:
211211
`Class.AlignOrientation.PrimaryAxis|PrimaryAxis` and
212212
`Class.AlignOrientation.SecondaryAxis|SecondaryAxis` properties
213213
respectively.
214-
code_samples:
214+
code_samples: []
215215
type: OrientationAlignmentMode
216216
tags: []
217217
deprecation_message: ''
@@ -234,7 +234,7 @@ properties:
234234
The direction of the goal's **X** axis, represented as a unit
235235
`Datatype.Vector3`. Only used when `Class.AlignOrientation.Mode|Mode` is
236236
`Enum.OrientationAlignmentMode|OneAttachment`.
237-
code_samples:
237+
code_samples: []
238238
type: Vector3
239239
tags:
240240
- NotReplicated
@@ -261,7 +261,7 @@ properties:
261261
262262
Enabling `Class.AlignOrientation.PrimaryAxisOnly|PrimaryAxisOnly` also
263263
enables the `Class.AlignOrientation.AlignType|AlignType` property.
264-
code_samples:
264+
code_samples: []
265265
type: boolean
266266
tags: []
267267
deprecation_message: |
@@ -292,7 +292,7 @@ properties:
292292
`Class.Constraint.Attachment1|Attachment1` remains unaffected. If true,
293293
the constraint applies torque to both attachments in **equal and opposite
294294
directions**.
295-
code_samples:
295+
code_samples: []
296296
type: boolean
297297
tags: []
298298
deprecation_message: ''
@@ -314,7 +314,7 @@ properties:
314314
description: |
315315
Controls how quickly the constraint reaches its goal. Higher values cause
316316
the attachment(s) to align more rapidly. Value can be between 5 and 200.
317-
code_samples:
317+
code_samples: []
318318
type: float
319319
tags: []
320320
deprecation_message: ''
@@ -341,7 +341,7 @@ properties:
341341
`Class.AlignOrientation.MaxAngularVelocity|MaxAngularVelocity`, and
342342
`Class.AlignOrientation.Responsiveness|Responsiveness`. If true, the
343343
physics solver reacts as quickly as possible to complete the alignment.
344-
code_samples:
344+
code_samples: []
345345
type: boolean
346346
tags: []
347347
deprecation_message: ''
@@ -364,7 +364,7 @@ properties:
364364
The direction of the goal's **Y** axis, represented as a unit
365365
`Datatype.Vector3`. Only used when `Class.AlignOrientation.Mode|Mode` is
366366
`Enum.OrientationAlignmentMode|OneAttachment`.
367-
code_samples:
367+
code_samples: []
368368
type: Vector3
369369
tags:
370370
- NotReplicated

content/en-us/reference/engine/classes/AlignPosition.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ description: |
4848
4949
This constraint can use either **one** or **two** attachments in calculating
5050
its goal. See `Class.AlignPosition.Mode|Mode` for details.
51-
code_samples:
51+
code_samples: []
5252
inherits:
5353
- Constraint
5454
tags: []
@@ -65,7 +65,7 @@ properties:
6565
meaning that if the parent's center of mass is not aligned with the
6666
direction of the force, torque will be applied as well as force. When
6767
true, force is applied at the parents' center of mass.
68-
code_samples:
68+
code_samples: []
6969
type: boolean
7070
tags: []
7171
deprecation_message: ''
@@ -181,7 +181,7 @@ properties:
181181
`Class.AlignPosition.MaxVelocity|MaxVelocity`, are **caps** to the force
182182
and velocity respectively. The actual scale is determined by
183183
`Class.AlignPosition.Responsiveness|Responsiveness`.
184-
code_samples:
184+
code_samples: []
185185
type: float
186186
tags: []
187187
deprecation_message: ''
@@ -207,7 +207,7 @@ properties:
207207
`Class.AlignPosition.MaxForce|MaxForce`, are **caps** to the velocity and
208208
force respectively. The actual scale is determined by
209209
`Class.AlignPosition.Responsiveness|Responsiveness`.
210-
code_samples:
210+
code_samples: []
211211
type: float
212212
tags: []
213213
deprecation_message: ''
@@ -238,7 +238,7 @@ properties:
238238
disregards `Class.Constraint.Attachment1|Attachment1` and attempts to move
239239
`Class.Constraint.Attachment0|Attachment0` to
240240
`Class.AlignPosition.Position|Position`.
241-
code_samples:
241+
code_samples: []
242242
type: PositionAlignmentMode
243243
tags: []
244244
deprecation_message: ''
@@ -263,7 +263,7 @@ properties:
263263
`Class.AlignPosition.Mode|Mode` is set to
264264
`Enum.PositionAlignmentMode|OneAttachment`, in which case
265265
`Class.Constraint.Attachment1|Attachment1` is disregarded.
266-
code_samples:
266+
code_samples: []
267267
type: Vector3
268268
tags: []
269269
deprecation_message: ''
@@ -289,7 +289,7 @@ properties:
289289
`Class.Constraint.Attachment1|Attachment1` remains unaffected. If true,
290290
the constraint applies force to both attachments in **equal and opposite
291291
directions**.
292-
code_samples:
292+
code_samples: []
293293
type: boolean
294294
tags: []
295295
deprecation_message: ''
@@ -311,7 +311,7 @@ properties:
311311
description: |
312312
Controls how quickly the constraint reaches its goal. Higher values cause
313313
the attachment(s) to align more rapidly. Value can be between 5 and 200.
314-
code_samples:
314+
code_samples: []
315315
type: float
316316
tags: []
317317
deprecation_message: ''
@@ -338,7 +338,7 @@ properties:
338338
`Class.AlignPosition.MaxVelocity|MaxVelocity`, and
339339
`Class.AlignPosition.Responsiveness|Responsiveness`. If true, the physics
340340
solver reacts as quickly as possible to complete the alignment.
341-
code_samples:
341+
code_samples: []
342342
type: boolean
343343
tags: []
344344
deprecation_message: ''

0 commit comments

Comments
 (0)