闪光是几个粒
当 Sparkles.Enabled 被
闪光粒子只能从BasePart的中心发射,它们的父辈是。父辈一个闪光对象到一个Attachment,而不是直接父辈它们。
代码示例
The code sample below gives any new players sparkles that are colored the same as their torso color.
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 无异,除了它是一个颜色而不是一个 ColorSequence 。闪光有一个自然的颜色序
需要注意,闪光有一个部分 ParticleEmitter.LightEmission 效果,因此黑暗颜色往往会更加透明,白色颜色看起来很亮。
代码示例
The code sample below gives any new players sparkles that are colored the same as their torso color.
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.
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 相同。
闪光颜色属性确定所有颗粒发出的颜色都是通过 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.
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)