Sparkles

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

類別parkles 是一個

Sparkles.Enabled

火花粒子只從 BasePart 的中心發射,這與它們的上一個親級關係。將 Sparkles 對象親和到 Attachment 中,而不是將它們親和到 Class.BasePart 中,可以允許自訂粒子的開始位置。

範例程式碼

The code sample below gives any new players sparkles that are colored the same as their torso color.

Give Sparkles

local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)

概要

屬性

屬性

Color

隱藏
未複製
平行讀取

顏色屬性決定所有粒子發射的顏色,包括現有和未來粒子。它與 Sparkles 對象 (包括現有和未來的粒子) 相同,除了它只是一個顏色,而不是 ParticleEmitter.Color 。閃光有一個天然的��

需要注意,火花有一個部分 ParticleEmitter.LightEmission 效果,因此黑色顏色往往會更加透明,白色顏色看起來很亮。

範例程式碼

The code sample below gives any new players sparkles that are colored the same as their torso color.

Give Sparkles

local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)

Enabled

平行讀取

啟用屬性,與 ParticleEmitter.Enabled 非常相似,決定是否發射火花粒。任何粒子都會發射,直到它們的生命時間結束。這個屬性有助於在需要後立即移除火焰對象的燃燒


local Debris = game:GetService("Debris")
local part = script.Parent
function stopSparkling(sparkles)
sparkles.Enabled = false -- No more new particles
Debris:AddItem(sparkles, 4) -- Remove the object after a delay (after existing particles have expired)
end
stopSparkling(part.Sparkles)

範例程式碼

The code sample below gives any new players sparkles that are colored the same as their torso color.

Give Sparkles

local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)

LocalTransparencyModifier

隱藏
未複製
平行讀取

SparkleColor

平行讀取

此屬性與 Sparkles.Color 相同。

SparkleColor 屬性決定所有粒子發射的顏色,Sparkles 對象 (包括現有和未來的粒子) 。它與ParticleEmitter.Color 相同,除了它是一個顏色,而不是一個 Datatype.ColorSequ

需要注意,火花有一個部分 ParticleEmitter.LightEmission 效果,因此黑色顏色往往會更加透明,白色顏色看起來很亮。

範例程式碼

The code sample below gives any new players sparkles that are colored the same as their torso color.

Give Sparkles

local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)

TimeScale

平行讀取

方法

活動