学ぶ
エンジンクラス
Player

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


概要
方法
GetFriendsOnline(maxFriends: number):{any}
非推奨
GetRankInGroup(groupId: number):number
非推奨
GetRankInGroupAsync(groupId: number):number
非推奨
GetRoleInGroup(groupId: number):string
非推奨
GetRoleInGroupAsync(groupId: number):string
非推奨
IsBestFriendsWith(userId: User):boolean
非推奨
IsFriendsWith(userId: User):boolean
非推奨
isFriendsWith(userId: User):boolean
非推奨
IsInGroup(groupId: number):boolean
非推奨
Kick(message: string):()
LoadBoolean(key: string):boolean
非推奨
loadBoolean(key: string):boolean
非推奨
LoadCharacter():()
非推奨
LoadCharacterAppearance(assetInstance: Instance):()
非推奨
LoadCharacterWithHumanoidDescription(humanoidDescription: HumanoidDescription,assetTypeVerification: Enum.AssetTypeVerification):()
非推奨
LoadInstance(key: string):Instance
非推奨
loadInstance(key: string):Instance
非推奨
LoadNumber(key: string):number
非推奨
loadNumber(key: string):number
非推奨
LoadString(key: string):string
非推奨
loadString(key: string):string
非推奨
Move(walkDirection: Vector3,relativeToCamera: boolean):()
RequestStreamAroundAsync(position: Vector3,timeOut: number):()
SaveBoolean(key: string,value: boolean):()
非推奨
saveBoolean(key: string,value: boolean):()
非推奨
SaveInstance(key: string,value: Instance):()
非推奨
saveInstance(key: string,value: Instance):()
非推奨
SaveNumber(key: string,value: number):()
非推奨
saveNumber(key: string,value: number):()
非推奨
SaveString(key: string,value: string):()
非推奨
saveString(key: string,value: string):()
非推奨
SetAccountAge(accountAge: number):()
継承されたメンバー

APIリファレンス
プロパティ
AccountAge
読み取り専用
複製されていません
並列読み取り
機能: Players
Player.AccountAge:number

AutoJumpEnabled
並列読み取り
機能: Players
Player.AutoJumpEnabled:boolean
コードサンプル
オートジャンプ切り替え
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local button = script.Parent
local function update()
-- ボタンのテキストを更新
if player.AutoJumpEnabled then
button.Text = "オートジャンプはオンです"
else
button.Text = "オートジャンプはオフです"
end
-- プレイヤーのキャラクターにプロパティを反映
if player.Character then
local human = player.Character:FindFirstChild("Humanoid")
if human then
human.AutoJumpEnabled = player.AutoJumpEnabled
end
end
end
local function onActivated()
-- オートジャンプを切り替え
player.AutoJumpEnabled = not player.AutoJumpEnabled
-- その他を更新
update()
end
button.Activated:Connect(onActivated)
update()

CameraMaxZoomDistance
並列読み取り
機能: Players
Player.CameraMaxZoomDistance:number

CameraMinZoomDistance
並列読み取り
機能: Players
Player.CameraMinZoomDistance:number

CameraMode
並列読み取り
機能: Players
Player.CameraMode:Enum.CameraMode
コードサンプル
一人称視点でプレイ
local Players = game:GetService("Players")
local player = Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson

CanLoadCharacterAppearance
並列読み取り
機能: Players
Player.CanLoadCharacterAppearance:boolean

Character
並列読み取り
機能: Players
Player.Character:Model

CharacterAppearance
非推奨

CharacterAppearanceId
並列読み取り
機能: Players
Player.CharacterAppearanceId:number

DataComplexity
非推奨

DataReady
非推奨

DevCameraOcclusionMode
並列読み取り
機能: Players
Player.DevCameraOcclusionMode:Enum.DevCameraOcclusionMode

DevComputerCameraMode
並列読み取り
機能: Players
Player.DevComputerCameraMode:Enum.DevComputerCameraMovementMode

DevComputerMovementMode
並列読み取り
機能: Players
Player.DevComputerMovementMode:Enum.DevComputerMovementMode

DevEnableMouseLock
並列読み取り
機能: Players
Player.DevEnableMouseLock:boolean

DevTouchCameraMode
並列読み取り
機能: Players
Player.DevTouchCameraMode:Enum.DevTouchCameraMovementMode

DevTouchMovementMode
並列読み取り
機能: Players
Player.DevTouchMovementMode:Enum.DevTouchMovementMode

DisplayName
並列読み取り
機能: Players
Player.DisplayName:string

FollowUserId
読み取り専用
複製されていません
並列読み取り
機能: Players
Player.FollowUserId:number
コードサンプル
フォロワーアラート
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = player:WaitForChild("PlayerGui")
local function onPlayerAdded(newPlayer)
if newPlayer.FollowUserId == player.UserId then
local textLabel = Instance.new("TextLabel")
textLabel.Parent = screenGui
textLabel.Text = "あなたは " .. newPlayer.Name .. " にフォローされてこのゲームに来ました!"
task.delay(3, function()
if textLabel then
textLabel:Destroy()
end
end)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)

GameplayPaused
非表示
アクセスできないセキュリティ
並列読み取り
機能: Players
Player.GameplayPaused:boolean

HasRobloxSubscription
Robloxのセキュリティ
並列読み取り
機能: Players
Player.HasRobloxSubscription:boolean
コードサンプル
ロブロックスのサブスクリプションステータスを確認
local Players = game:GetService("Players")
local player = Players.LocalPlayer
if player.HasRobloxSubscription then
-- サブスクライバー専用のコンテンツまたは特典を付与
end

HasVerifiedBadge
並列読み取り
機能: Players
Player.HasVerifiedBadge:boolean

HealthDisplayDistance
並列読み取り
機能: Players
Player.HealthDisplayDistance:number

InputLatency
Robloxのセキュリティ
並列読み取り
機能: Players
Player.InputLatency:number

LocaleId
非表示
読み取り専用
複製されていません
並列読み取り
機能: Players
Player.LocaleId:string

MembershipType
非推奨

NameDisplayDistance
並列読み取り
機能: Players
Player.NameDisplayDistance:number

Neutral
並列読み取り
機能: Players
Player.Neutral:boolean

PartyId
非表示
複製されていません
Robloxのセキュリティ
並列読み取り
機能: Players
Player.PartyId:string
コードサンプル
プレイヤー.PartyId
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local partyId = player.PartyId
if partyId ~= "" then
print("プレイヤーはID: " .. partyId .. " のパーティに参加しています")
else
print("プレイヤーはパーティに参加していません")
end
player:GetPropertyChangedSignal("PartyId"):Connect(function()
if player.PartyId ~= "" then
print("プレイヤーはID: " .. player.PartyId .. " のパーティに参加しました")
else
print("プレイヤーはパーティを離れました")
end
end)
end)

ReplicationFocus
並列読み取り
機能: Players
Player.ReplicationFocus:Instance

RespawnLocation
並列読み取り
機能: Players
Player.RespawnLocation:SpawnLocation
コードサンプル
タッチでスポーン変更
local Players = game:GetService("Players")
local function addSpawn(spawnLocation)
-- スポーンがタッチされたときにリッスンします
spawnLocation.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorOfClass("Model")
if character then
local player = Players:GetPlayerFromCharacter(character)
if player and player.RespawnLocation ~= spawnLocation then
local humanoid = character:FindFirstChildOfClass("Humanoid")
-- キャラクターが死んでいないことを確認します
if humanoid and humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
print("スポーンが設定されました")
player.RespawnLocation = spawnLocation
end
end
end
end)
end
local firstSpawn
-- ワークスペース内のスポーンを調べます
for _, descendant in pairs(workspace:GetDescendants()) do
if descendant:IsA("SpawnLocation") then
if descendant.Name == "FirstSpawn" then
firstSpawn = descendant
end
addSpawn(descendant)
end
end
local function playerAdded(player)
player.RespawnLocation = firstSpawn
end
-- 新しいプレイヤーをリッスンします
Players.PlayerAdded:Connect(playerAdded)
-- 既存のプレイヤーを処理します
for _, player in pairs(Players:GetPlayers()) do
playerAdded(player)
end

StepIdOffset
Robloxのセキュリティ
並列読み取り
機能: Players
Player.StepIdOffset:number

Team
複製されていません
並列読み取り
機能: Players
Player.Team:Team

TeamColor
並列読み取り
機能: Players
Player.TeamColor:BrickColor

ThirdPartyTextChatRestrictionStatus
読み取り専用
複製されていません
Robloxのスクリプトセキュリティ
並列読み取り
機能: Players
Player.ThirdPartyTextChatRestrictionStatus:Enum.ChatRestrictionStatus

User
Robloxのセキュリティ
並列読み取り
機能: Players
Player.User:User

UserId
並列読み取り
機能: Players
Player.UserId:number
コードサンプル
プレイヤー.UserId
local Players = game:GetService("Players")
local function onPlayerAdded(player)
print(player.UserId)
end
Players.PlayerAdded:Connect(onPlayerAdded)
データストアからリーダーボードへ
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local goldDataStore = DataStoreService:GetDataStore("Gold")
local STARTING_GOLD = 100
local function onPlayerAdded(player)
local playerKey = "Player_" .. player.UserId
local leaderstats = Instance.new("IntValue")
leaderstats.Name = "leaderstats"
local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Parent = leaderstats
local success, result = pcall(function()
return goldDataStore:GetAsync(playerKey) or STARTING_GOLD
end)
if success then
gold.Value = result
else
-- データの取得に失敗しました
warn(result)
end
leaderstats.Parent = player
end
Players.PlayerAdded:Connect(onPlayerAdded)

userId
非推奨

方法
AddReplicationFocus
機能: Players
Player:AddReplicationFocus(part:BasePart):()
パラメータ
戻り値
()

ClearCharacterAppearance
機能: Players
Player:ClearCharacterAppearance():()
戻り値
()
コードサンプル
キャラクターの外見をクリアする方法
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local function onChildRemoved(child)
print(child.ClassName, "がキャラクターから削除されました")
end
character.ChildRemoved:Connect(onChildRemoved)
player:ClearCharacterAppearance()
--> ボディカラーがキャラクターから削除されました
--> シャツグラフィックがキャラクターから削除されました
--> シャツがキャラクターから削除されました
--> パンツがキャラクターから削除されました
--> キャラクターメッシュがキャラクターから削除されました
--> 帽子がキャラクターから削除されました
--> シャツがキャラクターから削除されました

ClearCachedAvatarAppearance
機能: AvatarAppearance, Players
Player:ClearCachedAvatarAppearance():()
戻り値
()

DistanceFromCharacter
機能: Players
Player:DistanceFromCharacter(point:Vector3):number
パラメータ
point:Vector3
戻り値
コードサンプル
プレイヤーと位置の間の距離を測定する
local Players = game:GetService("Players")
for _, player in pairs(Players:GetPlayers()) do
print(player:DistanceFromCharacter(Vector3.new(0, 0, 0)))
end

GetFriendsOnline
非推奨

GetFriendsOnlineAsync
イールド
機能: Players, Social
Player:GetFriendsOnlineAsync(maxFriends:number):{any}
パラメータ
maxFriends:number
既定値: 200
戻り値
コードサンプル
オンライン接続のリストを取得
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local success, result = pcall(player.GetFriendsOnlineAsync, player, 10)
if success then
for _, friend in pairs(result) do
print(friend.UserName)
end
else
warn("オンラインプレイヤーの取得に失敗しました: " .. result)
end

GetFriendsWhoPlayedAsync
イールド
機能: Players, Social
Player:GetFriendsWhoPlayedAsync():{any}
戻り値

GetJoinData
機能: Players
Player:GetJoinData():Dictionary
戻り値
コードサンプル
トラフィックソースの追跡
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local analyticsStore = DataStoreService:GetDataStore("Analytics")
local ALLOWED_SOURCES = {
"twitter",
"youtube",
"discord",
}
local function onPlayerAdded(player)
local source = player:GetJoinData().LaunchData
-- 提供されたソースが有効かどうかを確認
if source and table.find(ALLOWED_SOURCES, source) then
-- ソースの人気を追跡するためにデータストアを更新
local success, result = pcall(analyticsStore.IncrementAsync, analyticsStore, source)
if success then
print(player.Name, "が", source, "から参加しました - 合計:", result)
else
warn("参加ソースの記録に失敗しました: " .. result)
end
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
リファラル URL ジェネレーター
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local DIRECT_JOIN_URL = "https://www.roblox.com/games/start?placeId=%d&launchData=%s"
local textBox = script.Parent
local function generateReferralURL(player)
return DIRECT_JOIN_URL:format(game.PlaceId, player.UserId)
end
local function highlightAll()
if -- 再帰的プロパティ更新を避ける
textBox:IsFocused() and not (textBox.SelectionStart == 1 and textBox.CursorPosition == #textBox.Text + 1)
then
textBox.SelectionStart = 1
textBox.CursorPosition = #textBox.Text + 1
end
end
textBox.Focused:Connect(highlightAll)
textBox:GetPropertyChangedSignal("SelectionStart"):Connect(highlightAll)
textBox:GetPropertyChangedSignal("CursorPosition"):Connect(highlightAll)
textBox.TextEditable = false
textBox.ClearTextOnFocus = false
textBox.Text = generateReferralURL(player)
テーブルを起動データとして使用する
local HttpService = game:GetService("HttpService")
local DATA_CHARACTER_LIMIT = 200
local function encodeTableAsLaunchData(data)
-- テーブルを文字列に変換する
local jsonEncodedData = HttpService:JSONEncode(data)
if #jsonEncodedData <= DATA_CHARACTER_LIMIT then
-- スペースなどの無効な可能性のある文字をエスケープする
local urlEncodedData = HttpService:UrlEncode(jsonEncodedData)
return true, urlEncodedData
else
-- 文字制限エラーを報告する
return false, ("エンコードされたテーブルが %d 文字の制限を超えています"):format(DATA_CHARACTER_LIMIT)
end
end
local sampleData = {
joinMessage = "こんにちは!",
urlCreationDate = os.time(),
magicNumbers = {
534,
1337,
746733573,
},
}
local success, encodedData = encodeTableAsLaunchData(sampleData)
if success then
print(encodedData)
else
warn("起動データのエンコードに失敗しました: " .. encodedData)
end
JSON起動データのデコード
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local function onPlayerAdded(player)
local launchData = player:GetJoinData().LaunchData
if launchData then
-- データをデコードしようとしています
local success, result = pcall(HttpService.JSONDecode, HttpService, launchData)
if success then
print(player.Name, "データを使用して参加しました:", result)
else
-- これはおそらくユーザーがURLをいじったためです
warn("起動データの解析に失敗しました:" .. result)
end
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
サーバーテレポートデータの例
local Players = game:GetService("Players")
local approvedPlaceIds = { 1 } -- 承認されたPlaceIdsをここに挿入
local function isPlaceIdApproved(placeId)
for _, id in pairs(approvedPlaceIds) do
if id == placeId then
return true
end
end
return false
end
local function onPlayerAdded(player)
local joinData = player:GetJoinData()
-- このデータが承認された場所から送信されたことを確認
if isPlaceIdApproved(joinData.SourcePlaceId) then
local teleportData = joinData.TeleportData
if teleportData then
local currentLevel = teleportData.currentLevel
print(player.Name .. " はレベル " .. currentLevel .. " にいます")
end
end
end
Players.PlayerAdded:Connect(onPlayerAdded)

GetMouse
機能: Input, Players
Player:GetMouse():Mouse
戻り値

GetNetworkPing
並列書き込み
機能: Players
Player:GetNetworkPing():number
戻り値

GetRankInGroup
非推奨

GetRankInGroupAsync
非推奨

GetRoleInGroup
非推奨

GetRoleInGroupAsync
非推奨

HasAppearanceLoaded
機能: Players
Player:HasAppearanceLoaded():boolean
戻り値
コードサンプル
プレイヤーの外見が読み込まれたか確認する
local Players = game:GetService("Players")
local function onPlayerAdded(player)
local loaded = player:HasAppearanceLoaded()
print(loaded)
while not loaded do
loaded = player:HasAppearanceLoaded()
print(loaded)
task.wait()
end
end
Players.PlayerAdded:Connect(onPlayerAdded)

IsBestFriendsWith
非推奨

IsFriendsWith
非推奨

isFriendsWith
非推奨

IsFriendsWithAsync
イールド
機能: Players, Social
Player:IsFriendsWithAsync(userId:User):boolean
パラメータ
userId:User
戻り値

IsInGroup
非推奨

IsInGroupAsync
イールド
機能: Players, Groups
Player:IsInGroupAsync(groupId:number):boolean
パラメータ
groupId:number
戻り値

IsVerified
機能: Players
Player:IsVerified():boolean
戻り値
コードサンプル
IsVerifiedの使用
local Players = game:GetService("Players")
local function onPlayerAdded(player)
print(player:IsVerified())
end
for _, player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)

Kick
機能: Players, Consequences
Player:Kick(message:string):()
パラメータ
message:string
戻り値
()

LoadBoolean
非推奨

loadBoolean
非推奨

LoadCharacter
非推奨

LoadCharacterAppearance
非推奨

LoadCharacterAsync
イールド
機能: Players
Player:LoadCharacterAsync():()
戻り値
()
コードサンプル
自動読み込みをオフにしてキャラクターのリスポーンをシミュレート
local Players = game:GetService("Players")
local RESPAWN_DELAY = 5
Players.CharacterAutoLoads = false
local function onPlayerAdded(player)
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
local function onDied()
task.wait(RESPAWN_DELAY)
player:LoadCharacterAsync()
end
humanoid.Died:Connect(onDied)
end
player.CharacterAdded:Connect(onCharacterAdded)
player:LoadCharacterAsync()
end
Players.PlayerAdded:Connect(onPlayerAdded)

LoadCharacterWithHumanoidDescription
非推奨

LoadCharacterWithHumanoidDescriptionAsync
イールド
機能: Players
Player:LoadCharacterWithHumanoidDescriptionAsync(
humanoidDescription:HumanoidDescription, assetTypeVerification:Enum.AssetTypeVerification
):()
パラメータ
humanoidDescription:HumanoidDescription
assetTypeVerification:Enum.AssetTypeVerification
既定値: "Default"
戻り値
()
コードサンプル
ヒューマノイド説明を用いてキャラクターを生成
local Players = game:GetService("Players")
Players.CharacterAutoLoads = false
local function onPlayerAdded(player)
local humanoidDescription = Instance.new("HumanoidDescription")
humanoidDescription.HatAccessory = "2551510151,2535600138"
humanoidDescription.BodyTypeScale = 0.1
humanoidDescription.ClimbAnimation = 619521311
humanoidDescription.Face = 86487700
humanoidDescription.GraphicTShirt = 1711661
humanoidDescription.HeadColor = Color3.new(0, 1, 0)
player:LoadCharacterWithHumanoidDescriptionAsync(humanoidDescription)
end
Players.PlayerAdded:Connect(onPlayerAdded)

LoadInstance
非推奨

loadInstance
非推奨

LoadNumber
非推奨

loadNumber
非推奨

LoadString
非推奨

loadString
非推奨

Move
機能: Players
Player:Move(
walkDirection:Vector3, relativeToCamera:boolean
):()
パラメータ
walkDirection:Vector3
relativeToCamera:boolean
既定値: false
戻り値
()
コードサンプル
カメラに対するプレイヤーの移動
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
-- プレイヤーのキャラクターとヒューマノイドを待機します。これは :Move() を呼び出す前に存在している必要があります。
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
character:WaitForChild("Humanoid")
-- プレイヤーは、実行時のカメラの位置から50スタッド離れるまで移動します。
localPlayer:Move(Vector3.new(0, 0, -50), true)

RemoveReplicationFocus
機能: Players
Player:RemoveReplicationFocus(part:BasePart):()
パラメータ
戻り値
()

RequestStreamAroundAsync
イールド
機能: Players
Player:RequestStreamAroundAsync(
position:Vector3, timeOut:number
):()
パラメータ
position:Vector3
timeOut:number
既定値: 0
戻り値
()

SaveBoolean
非推奨

saveBoolean
非推奨

SaveInstance
非推奨

saveInstance
非推奨

SaveNumber
非推奨

saveNumber
非推奨

SaveString
非推奨

saveString
非推奨

SetAccountAge
プラグインのセキュリティ
機能: Players
Player:SetAccountAge(accountAge:number):()
パラメータ
accountAge:number
戻り値
()

SetSuperSafeChat
プラグインのセキュリティ
機能: Players
Player:SetSuperSafeChat(value:boolean):()
パラメータ
value:boolean
戻り値
()

WaitForDataReady
非推奨

waitForDataReady
非推奨

イベント
CharacterAdded
機能: Players
Player.CharacterAdded(character:Model):RBXScriptSignal
パラメータ
character:Model
コードサンプル
プレイヤーのスポーンとデスポーンの検出
local Players = game:GetService("Players")
local function onCharacterAdded(character)
print(character.Name .. " がスポーンしました")
end
local function onCharacterRemoving(character)
print(character.Name .. " がデスポーンしています")
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
player.CharacterRemoving:Connect(onCharacterRemoving)
end
Players.PlayerAdded:Connect(onPlayerAdded)
アクセサリ除去ツール
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local function destroyAccessory(object)
if object:IsA("Hat") or object:IsA("Accessory") then
object:Destroy()
end
end
local function onCharacterAdded(character)
-- アクセサリを除去する前に短い間待機して、
-- "Something unexpectedly set ___ parent to NULL" の警告を避けます
RunService.Stepped:Wait()
-- プレイヤーのキャラクターに既存のアクセサリがあるかチェックします
for _, child in pairs(character:GetChildren()) do
destroyAccessory(child)
end
-- キャラクターに帽子が追加されるのは、
-- CharacterAdded が発火してから少し後かもしれないので、ChildAdded を使ってそれを監視します
character.ChildAdded:Connect(destroyAccessory)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)

CharacterAppearanceLoaded
機能: Players
Player.CharacterAppearanceLoaded(character:Model):RBXScriptSignal
パラメータ
character:Model
コードサンプル
ロード後にアクセサリーを削除
local Players = game:GetService("Players")
local function onPlayerAddedAsync(player)
local connection = player.CharacterAppearanceLoaded:Connect(function(character)
-- この時点ですべてのアクセサリーが読み込まれました
local humanoid = character:FindFirstChildOfClass("Humanoid")
local numAccessories = #humanoid:GetAccessories()
print(("%d 個のアクセサリーを %s のために破壊します"):format(numAccessories, player.Name))
humanoid:RemoveAccessories()
end)
-- プレイヤーが退出した後に接続を切断することを確認します
-- プレイヤーがガーベジコレクトされるのを許可するため
player.AncestryChanged:Wait()
connection:Disconnect()
end
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAddedAsync, player)
end
Players.PlayerAdded:Connect(onPlayerAddedAsync)

CharacterRemoving
機能: Players
Player.CharacterRemoving(character:Model):RBXScriptSignal
パラメータ
character:Model
コードサンプル
プレイヤーのスポーンとデスポーンの検出
local Players = game:GetService("Players")
local function onCharacterAdded(character)
print(character.Name .. " がスポーンしました")
end
local function onCharacterRemoving(character)
print(character.Name .. " がデスポーンしています")
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
player.CharacterRemoving:Connect(onCharacterRemoving)
end
Players.PlayerAdded:Connect(onPlayerAdded)

Chatted
機能: Chat, Players
Player.Chatted(
message:string, recipient:Player
パラメータ
message:string
recipient:Player

Idled
機能: Players
Player.Idled(time:number):RBXScriptSignal
パラメータ
time:number

OnTeleport
機能: Players, Teleport
Player.OnTeleport(
teleportState:Enum.TeleportState, placeId:number, spawnName:string
パラメータ
teleportState:Enum.TeleportState
placeId:number
spawnName:string
コードサンプル
プレイヤー.OnTeleport
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local playerOnTeleport = player
player.OnTeleport:Connect(function(teleportState, _placeId, _spawnName)
if teleportState == Enum.TeleportState.Started then
print("テレポートが始まりました (" .. playerOnTeleport.Name .. ")")
elseif teleportState == Enum.TeleportState.WaitingForServer then
print("サーバーを待っています (" .. playerOnTeleport.Name .. ")")
elseif teleportState == Enum.TeleportState.InProgress then
print("テレポート進行中 (" .. playerOnTeleport.Name .. ")")
elseif teleportState == Enum.TeleportState.Failed then
print("テレポートに失敗しました! (" .. playerOnTeleport.Name .. ")")
end
end)
end)

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。