概要
プロパティ
コードサンプル
松明を灯す
local Workspace = game:GetService("Workspace")
for _, descendant in Workspace:GetDescendants() do
if descendant.Name == "Torch" and descendant:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.SecondaryColor = Color3.new(1, 1, 1)
fire.Size = math.max(descendant.Size.X, descendant.Size.Z) -- 2つの次元のうち大きい方を選択
fire.Parent = descendant
end
end火のエフェクトを切り替える
local part = script.Parent
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part
local fire = Instance.new("Fire")
fire.Parent = part
local light = Instance.new("PointLight")
light.Parent = part
local function onClick()
fire.Enabled = not fire.Enabled
light.Enabled = fire.Enabled
end
clickDetector.MouseClick:Connect(onClick)APIリファレンス
プロパティ
Enabled
コードサンプル
有効
local Debris = game:GetService("Debris")
local function douseFlames(fire)
fire.Enabled = false -- これ以上新しいパーティクルはありません
Debris:AddItem(fire, 2) -- 既存のパーティクルが消えた後にオブジェクトを削除します
end
local part = Instance.new("Part")
part.Anchored = true
part.Parent = workspace
local fire = Instance.new("Fire")
fire.Parent = part
douseFlames(part.Fire)size