Skip to content

Commit

Permalink
update Open Source Docs from Roblox internal teams
Browse files Browse the repository at this point in the history
  • Loading branch information
rbx-open-source-docs[bot] committed Jan 8, 2025
1 parent fdb299e commit da2935d
Show file tree
Hide file tree
Showing 35 changed files with 574 additions and 303 deletions.
10 changes: 10 additions & 0 deletions content/common/navigation/engine/reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3298,6 +3298,11 @@ navigation:
type: engineapi
source: /reference/engine/enums/AdEventType.yaml
ignoreTranslation: true
- title: AdFormat
path: /reference/engine/enums/AdFormat
type: engineapi
source: /reference/engine/enums/AdFormat.yaml
ignoreTranslation: true
- title: AdornCullingMode
path: /reference/engine/enums/AdornCullingMode
type: engineapi
Expand Down Expand Up @@ -4918,6 +4923,11 @@ navigation:
type: engineapi
source: /reference/engine/enums/Severity.yaml
ignoreTranslation: true
- title: ShowAdResult
path: /reference/engine/enums/ShowAdResult
type: engineapi
source: /reference/engine/enums/ShowAdResult.yaml
ignoreTranslation: true
- title: SignalBehavior
path: /reference/engine/enums/SignalBehavior
type: engineapi
Expand Down

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion content/en-us/chat/bubble-chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ if not bubbleImageLabel then
bubbleImageLabel = Instance.new("ImageLabel")
bubbleImageLabel.Parent = bubbleChatConfiguration
end
bubbleImageLabel.Image = "rbxassetid://6733332557"
bubbleImageLabel.Image = "rbxassetid://109157529833093"
bubbleImageLabel.ScaleType = Enum.ScaleType.Slice
bubbleImageLabel.SliceCenter = Rect.new(40, 40, 320, 120)
bubbleImageLabel.SliceScale = 0.5
Expand Down
4 changes: 2 additions & 2 deletions content/en-us/cloud/open-cloud/oauth2-registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ redirect URLs meet the following requirements:
## Submitting for Review

To minimize the chances of malicious apps harming the community, registering an
app doesn't make it publicly accessible. Instead, it remains in **private mode**
with a limit of 100 authorized users. This mode is helpful for testing and
app doesn't make it broadly accessible. Instead, it remains in **private mode**
with a limit of 10 unique users. This mode is helpful for testing and
debugging within your team.

If you want to extend the user base for your app, you need to publish it in
Expand Down
103 changes: 22 additions & 81 deletions content/en-us/input/mobile.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Over half of all Roblox sessions are played on mobile devices, so it's important

When designing a mobile experience, consider the [device orientation](#device-orientation) that you intend user's to use in your experience, then implement your inputs with `Class.ContextActionService` to perform the following mobile-related input tasks:

- [Create on-screen buttons](#adding-mobile-buttons) visible only on mobile devices.
- [Customize the mobile buttons and UI](#customizing-button-ui) to create a unique mobile experience.
- [Create on-screen buttons](#custom-mobile-buttons) visible only on mobile devices.
- [Setup context dependent inputs](#context-dependent-inputs) that allows the same button or input to perform a different action depending on the situation.
- [Detect other input devices](#detecting-other-devices), such as a mouse or keyboard connected to a mobile tablet, to provide the correct on-screen prompts to the user.

Expand Down Expand Up @@ -165,11 +164,9 @@ When `Class.StarterPlayer.AutoJumpEnabled` is enabled, the user's character auto

Disable `Class.StarterPlayer.AutoJumpEnabled` to disable this feature and force users to jump only using their key bindings.

## Adding Mobile Buttons
## Custom Mobile Buttons

To add mobile buttons, use the `Class.ContextActionService:BindAction()` method.

The `Class.ContextActionService:BindAction()|BindAction()` method takes the following parameters:
To add custom mobile buttons, use the `Class.ContextActionService:BindAction()` method which takes the following parameters:

<table>
<thead>
Expand All @@ -181,25 +178,25 @@ The `Class.ContextActionService:BindAction()|BindAction()` method takes the foll
</thead>
<tbody>
<tr>
<td>actionName</td>
<td>`actionName`</td>
<td>string</td>
<td>An identifier string for the action you are binding. You can use the actionName with other functions in `Class.ContextActionService` to edit the binding.</td>
</tr>
<tr>
<td>functionToBind</td>
<td>`functionToBind`</td>
<td>function</td>
<td>The function to call when the specified input is triggered. This function receives three arguments:
<ul><li> A string equal to the actionName.</li>
<li> A `Enum.UserInputState` which defines the input state when it called the function.</li>
<li> The `Class.InputObject` used in the function call.</li></ul></td>
</tr>
<tr>
<td>createTouchButton</td>
<td>`createTouchButton`</td>
<td>boolean</td>
<td>When true, creates an on-screen button when the game is running on a mobile device.</td>
</tr>
<tr>
<td>inputTypes</td>
<td>`inputTypes`</td>
<td>tuple</td>
<td>The inputs you intend to bind to the function, such as enum values from a `Enum.KeyCode`.</td>
</tr>
Expand All @@ -221,63 +218,30 @@ end
ContextActionService:BindAction("Interact", handleAction, true, Enum.KeyCode.T, Enum.KeyCode.ButtonR1)
```

### Removing Mobile Buttons

To remove a mobile button from the screen, call `Class.ContextActionService:UnbindAction()|UnbindAction()` using the actionName string you passed to `Class.ContextActionService:BindAction()|BindAction()`.

Use the following code sample to unbind the previously created Interact action:

```lua
-- Unbind action by name
ContextActionService:UnbindAction("Interact")
```

## Customizing Button UI

You can use one of the several functions from `Class.ContextActionService` to customize the on-screen buttons that are created by `Class.ContextActionService:BindAction()|BindAction()`.
<Alert severity="info">
To remove a mobile button from the screen, call `Class.ContextActionService:UnbindAction()|UnbindAction()` using the `actionName` string you passed to `Class.ContextActionService:BindAction()|BindAction()`.
</Alert>

### Button Text
Once a custom button is added, you can use one of the several functions from `Class.ContextActionService` to customize the on-screen buttons that are created by `Class.ContextActionService:BindAction()|BindAction()`.

To change the text label for a mobile button, call `Class.ContextActionService:SetTitle()|SetTitle()` with the actionName string and a title:
- To change the text label for a mobile button, call `Class.ContextActionService:SetTitle()|SetTitle()` with the `actionName` string and a title string.
- To use a custom image just like other GUI buttons, call `Class.ContextActionService:SetImage()|SetImage()` method, replacing the example asset ID below with an image of your choice.
- To set a button's position, call `Class.ContextActionService:SetPosition()|SetPosition()` with a `Datatype.UDim2` position value.

```lua
-- Set button label to "Talk"
ContextActionService:SetTitle("Interact", "Talk")
```

### Button Image

Mobile buttons can use custom images just like other GUI buttons using the `Class.ContextActionService:SetImage()|SetImage()` method.

Use the following sample code to set a button image, replacing the asset ID with an image of your choice:

```lua
-- Set button image
ContextActionService:SetImage("Interact", "rbxassetid://0123456789")
```

### Button Position

By default, a new button's position appears near the lower right section of the screen. You should carefully consider button placement on mobile devices and keep in mind the positions of thumbs and hands.

Use the following sample code to set a button's position with the `Class.ContextActionService:SetPosition()|SetPosition()` method:

```lua
ContextActionService:SetImage("Interact", "rbxassetid://104919049969988")
-- Set button position
ContextActionService:SetPosition("Interact", UDim2.new(1, -70, 0, 10))
```

## Context-Dependent Inputs
### Context-Dependent Inputs

When developing for mobile devices you may often want to change what a single button does based on the context. Since screen space on mobile devices is limited, use contextual buttons that perform different actions based on what the character is able to do.

For example, you can display an active "Collect" button when the user is standing near a chest of gold:

<img
src="../assets/scripting/input/Cross-Platform-Input-Detection-Mobile.png"
width="80%" />

Use the following code sample to create a mobile button that is labelled "Collect" and is bound to the function collectTreasure():
For example, you can display an active "Collect" button when the user is standing near a chest of gold, bound to the function `collectTreasure()`:

```lua
local ContextActionService = game:GetService("ContextActionService")
Expand All @@ -289,45 +253,22 @@ local function collectTreasure(actionName, inputState, inputObject)
end

ContextActionService:BindAction("Interact", collectTreasure, true, Enum.KeyCode.T, Enum.KeyCode.ButtonR1)
ContextActionService:SetTitle("Interact", "Collect")
ContextActionService:SetPosition("Interact", UDim2.new(1, -70, 0, 10))
-- Set image to blue "Collect" button
ContextActionService:SetImage("Interact", "rbxassetid://0123456789")
```

At another point in the game, you can change the button to "Talk" when the user is standing near an NPC. Instead of adding and removing the existing button, you can simply use `Class.ContextActionService:BindAction()` on the existing Interact action, changing the function and button image.

Use the following code sample to set the existing button label to "Talk" and bind it to a function named talkToNPC():
At another point during gameplay, you can change the button to "Talk" when the user is standing near an NPC. Instead of removing the existing button to place another, you can simply call `Class.ContextActionService:BindAction()|BindAction()` on the existing `"Interact"` action, changing the target function and button title:

```lua
ContextActionService:BindAction("Interact", talkToNPC, true, Enum.KeyCode.T, Enum.KeyCode.ButtonR1)
-- Set image to yellow "Talk" button
ContextActionService:SetImage("Interact", "rbxassetid://0011223344")
ContextActionService:SetTitle("Interact", "Talk")
```

## Detecting Other Devices

In cross-platform experiences, it is necessary to know the user's current device in order to adjust the UI and display correct key binding prompts.

For example, if a user approaches a treasure chest and there's an action bound to collecting the gold, you can show mobile users an on-screen "Collect" button and desktop users an on-screen "T" key icon.

Keep in mind that a mobile device can also have a [mouse and keyboard](./mouse-and-keyboard.md) or [gamepad](./gamepad.md) plugged in. It is also possible that a desktop has a `Class.UserInputService.TouchEnabled|touchscreen` enabled. It is important to reference the user's preferred input options by displaying input options for the actively used device.

<GridContainer numColumns="2">
<figure>
<img src="../assets/scripting/input/Cross-Platform-Input-Detection-PC.png" />
<figcaption>PC</figcaption>
</figure>
<figure>
<img src="../assets/scripting/input/Cross-Platform-Input-Detection-Mobile.png" />
<figcaption>Mobile</figcaption>
</figure>
</GridContainer>

In these cases, you can use `Class.UserInputService` to detect which input devices are enabled. If multiple input devices are enabled, use `Class.UserInputService:GetLastInputType()` to get the user's last used input device to display on the UI.

You can use the following `Class.ModuleScript`, placed within `Class.ReplicatedStorage` and renamed to **UserInputModule**, to fetch the user's input type, after which you can adapt the UI layout or context to your experience's specific needs.
In cross-platform experiences, it's important to reference the user's preferred input options by displaying input options for the actively used device. For example, a mobile device can have a [mouse and keyboard](./mouse-and-keyboard.md) or [gamepad](./gamepad.md) connected, or it's possible that a desktop has a touchscreen enabled. If multiple input sources are enabled, you can use `Class.UserInputService:GetLastInputType()|GetLastInputType()` to get the user's last used input device.

Use the following `Class.ModuleScript` to check for enabled input devices and the last used input device:
As a foundation, you can use the following `Class.ModuleScript`, placed within `Class.ReplicatedStorage` and renamed to **UserInputModule**, to fetch the user's input type, after which you can adapt the UI layout or context to your experience's specific needs.

```lua
local UserInputService = game:GetService("UserInputService")
Expand Down
30 changes: 15 additions & 15 deletions content/en-us/projects/assets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ description: An overview of how assets work on the platform.

Almost everything in Roblox is represented as a cloud-based asset with a unique corresponding ID. This ID is typically in the form of `rbxassetid://[ID]`, which gets applied to various instances as a property that's appropriate for that particular asset type. For example, `Class.Texture`, `Class.MeshPart`, and `Class.Sound` instances reference image, mesh, and audio assets through their respective `Class.Texture.TextureID|TextureID`, `Class.MeshPart.MeshID|MeshID`, and `Class.Sound.SoundID|SoundID` properties.

<table>
<tbody>
<tr>
<td><img src="../../assets/modeling/textures-decals/Texture-Example-Grafitti04.png" alt="A decal asset of a young woman with a button for an eye." width="90%" /></td>
<td><img src="../../assets/modeling/meshes/Base-Mesh-In-Marketplace.png" alt="An untextured treasure chest MeshPart asset." width="90%" /></td>
<td><audio controls><source src="../../assets/studio/general/Boom-Impact.mp3" type="audio/mpeg"></source></audio></td>
</tr>
<tr>
<td><code>rbxassetid://7229442422</code></td>
<td><code>rbxassetid://6768917255</code></td>
<td><code>rbxassetid://9125402735</code></td>
</tr>
</tbody>
</table>
<GridContainer numColumns="3">
<figure>
`rbxassetid://7229442422`
<img src="../../assets/modeling/textures-decals/Texture-Example-Grafitti04.png" alt="A decal asset of a young woman with a button for an eye." width="90%" />
</figure>
<figure>
`rbxassetid://6768917255`
<img src="../../assets/modeling/meshes/Base-Mesh-In-Marketplace.png" alt="An untextured treasure chest MeshPart asset." width="90%" />
</figure>
<figure>
`rbxassetid://9125402735`
<audio controls><source src="../../assets/studio/general/Boom-Impact.mp3" type="audio/mpeg"></source></audio>
</figure>
</GridContainer>

This cloud-based asset system allows you to store assets through Roblox and reuse them across the platform in various contexts, such as in different objects and places, without maintaining local copies as part of each saved Studio experience. You can find millions of project assets in the [Creator Store][CreatorMarketplaceURL], equip avatar assets in the [Marketplace][MarketplaceURL], or you can create your own assets and [import](#asset-management) them directly into Studio through the asset management tools.

Expand Down Expand Up @@ -214,7 +214,7 @@ The content folder's location depends on the user's operating system:
</tr>
<tr>
<td>`GameThumbnail`</td>
<td>ID for an experience (`Class.DataModel.GameId`); shows the experience's primary [thumbnail](../../production/promotion/thumbnails.md)</td>
<td>ID for an experience (`Class.DataModel.GameId`); shows the experience's primary [thumbnail](../../production/publishing/thumbnails.md)</td>
<td scope="row">256&times;144, 384&times;216, 480&times;270, 576&times;324, 768&times;432</td>
</tr>
<tr>
Expand Down
28 changes: 14 additions & 14 deletions content/en-us/projects/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ objects are available and how to organize and use them, see

In Roblox, assets such as images, meshes, and audio are stored as **cloud-based assets**, so you don't need to bundle local copies into a saved Studio experience. Each asset in the cloud is assigned a unique **asset&nbsp;ID** from which multiple experiences can utilize them. You can create assets directly in Studio, such as models, or import assets like images, audio, and meshes from other tools.

<table>
<tbody>
<tr>
<td><img src="../assets/modeling/textures-decals/Texture-Example-Grafitti04.png" alt="A decal asset of a young woman with a button for an eye." width="90%" /></td>
<td><img src="../assets/modeling/meshes/Base-Mesh-In-Marketplace.png" alt="An untextured treasure chest MeshPart asset." width="90%" /></td>
<td><audio controls><source src="../assets/studio/general/Boom-Impact.mp3" type="audio/mpeg"></source></audio></td>
</tr>
<tr>
<td><code>rbxassetid://7229442422</code></td>
<td><code>rbxassetid://6768917255</code></td>
<td><code>rbxassetid://9125402735</code></td>
</tr>
</tbody>
</table>
<GridContainer numColumns="3">
<figure>
`rbxassetid://7229442422`
<img src="../assets/modeling/textures-decals/Texture-Example-Grafitti04.png" alt="A decal asset of a young woman with a button for an eye." width="90%" />
</figure>
<figure>
`rbxassetid://6768917255`
<img src="../assets/modeling/meshes/Base-Mesh-In-Marketplace.png" alt="An untextured treasure chest MeshPart asset." width="90%" />
</figure>
<figure>
`rbxassetid://9125402735`
<audio controls><source src="../assets/studio/general/Boom-Impact.mp3" type="audio/mpeg"></source></audio>
</figure>
</GridContainer>

By default, assets are private to your experience and you can use an asset in any place by referencing its ID. You can also distribute them to the community in the [Creator Store](https://create.roblox.com/store/), so others can use them as well.

Expand Down
Loading

0 comments on commit da2935d

Please sign in to comment.