SpawnLocationクラス
ひとことで言うと
プレイヤーが出現(スポーン)する場所になるパーツです。チェックポイントにも使えます。
公式の説明(英語):Class.SpawnLocation|SpawnLocations, or "spawns" determine where a Player respawns when they die. They can be configured to allow only certain players to use each spawn, using Class.Team|Teams. They also control how Class.ForceField|ForceFields are set up for newly-spawned players.
使用例
local Players = game:GetService("Players")
local checkpoint = script.Parent :: SpawnLocation
checkpoint.Touched:Connect(function(hit)
local character = hit.Parent
if not character or not character:IsA("Model") then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player then
player.RespawnLocation = checkpoint
end
end)スクリプトは、Luauの型チェック(luau-lsp)で確認しています。
クラスの関係
受け継いでいるクラス:Object → Instance → PVInstance → BasePart → FormFactorPart → Part → SpawnLocation
プロパティ(5)
| 名前と書き方 | 説明 |
|---|---|
AllowTeamChangeOnTouchSpawnLocation.AllowTeamChangeOnTouch: boolean | Allows a Player to join the team by touching the SpawnLocation. When set to true, if a Player character comes into contact with the SpawnLocation, the player's Player.TeamColor will be set to SpawnLocation.TeamColor. |
DurationSpawnLocation.Duration: int | 出現したあと、守られている(フォースフィールド)秒数。The length of time, in seconds, that a ForceField will be applied to a Player character spawning at this SpawnLocation. If Duration is zero, the ForceField is never created, and it will not trigger the Instance.DescendantAdded or Instance.ChildAdded events. |
EnabledSpawnLocation.Enabled: boolean | Sets whether or not the SpawnLocation is enabled. When disabled players cannot spawn at the SpawnLocation and the AllowTeamChangeOnTouch functionality is disabled. |
NeutralSpawnLocation.Neutral: boolean | trueにすると、どのチームのプレイヤーもここから出現します。Whether or not a SpawnLocation is affiliated with a specific team. This means that any Player, of any Team, can spawn on it if this property is set to true. |
TeamColorSpawnLocation.TeamColor: BrickColor | 出現できるチームの色。Sets what team the SpawnLocation is affiliated to. If SpawnLocation.Neutral property is false, only Class.Player|Players with the same Player.TeamColor as the spawn's TeamColor will be able to spawn there. |
受け継いでいるメンバー
BasePart から受け継いでいるもの(66)
Anchored・AssemblyAngularVelocity・AssemblyCenterOfMass・AssemblyLinearVelocity・AssemblyMass・AssemblyRootPart・AudioCanCollide・BackSurface・BottomSurface・BrickColor・CanCollide・CanQuery・CanTouch・CastShadow・CenterOfMass・CFrame・CollisionGroup・Color・CurrentPhysicalProperties・CustomPhysicalProperties・EnableFluidForces・ExtentsCFrame・ExtentsSize・FrontSurface・LeftSurface・Locked・Mass・Massless・Material・MaterialVariant・PivotOffset・Reflectance・ResizeableFaces・ResizeIncrement・RightSurface・RootPriority・Rotation・Size・TopSurface・Transparency・AngularAccelerationToTorque・ApplyAngularImpulse・ApplyImpulse・ApplyImpulseAtPosition・BindToCollisionSummaries・CanCollideWith・CanSetNetworkOwnership・GetClosestPointOnSurface・GetConnectedParts・GetJoints・GetMass・GetNetworkOwner・GetNetworkOwnershipAuto・GetNoCollisionConstraints・GetTouchingParts・GetVelocityAtPosition・IntersectAsync・IsGrounded・Resize・SetNetworkOwner・SetNetworkOwnershipAuto・SubtractAsync・TorqueToAngularAcceleration・UnionAsync・Touched・TouchEnded
PVInstance から受け継いでいるもの(4)
Instance から受け継いでいるもの(46)
Archivable・Capabilities・IsInSandbox・Name・Parent・PredictionMode・Sandboxed・AddTag・ClearAllChildren・Clone・Destroy・FindFirstAncestor・FindFirstAncestorOfClass・FindFirstAncestorWhichIsA・FindFirstChild・FindFirstChildOfClass・FindFirstChildWhichIsA・FindFirstDescendant・GetActor・GetAttribute・GetAttributeChangedSignal・GetAttributes・GetChildren・GetDebugId・GetDescendants・GetFullName・GetStyled・GetStyledPropertyChangedSignal・GetTags・HasTag・IsAncestorOf・IsDescendantOf・IsPropertyModified・QueryDescendants・RemoveTag・ResetPropertyToDefault・SetAttribute・WaitForChild・AncestryChanged・AttributeChanged・ChildAdded・ChildRemoved・DescendantAdded・DescendantRemoving・Destroying・StyledPropertiesChanged
Object から受け継いでいるもの(4)
SpawnLocationを使う記事
英語の説明とメンバーの一覧は、Roblox Creator Documentation(SpawnLocation)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。