Make parts ascend in the air before tweening from red to black, before fading out entirely and destroying

so basically, I would like parts to generate randomly around the map upwards, and after a period of time they fade into a different colour and fade out before destroying.

My code:

local area = workspace.Baseplate

local areaSize = area.Size * 0.5

local min = area.Position - areaSize
local max = area.Position + areaSize

local CUBE_GEN = workspace.CubesGenerator

local CUBE = Instance.new("Part")

CUBE.Color = Color3.new(1, 0, 0)
CUBE.Size = Vector3.new(20,20,20)

CUBE.CFrame = CFrame.new(
    math.random(min.X, max.X), 
    min.Y + CUBE.Size.Y * 0.5,
    math.random(min.Z, max.Z)
)
CUBE.Parent = workspace

local FLOAT_CUBE = Instance.new("BodyVelocity", CUBE)

FLOAT_CUBE.MaxForce = Vector3.new(1e9,1e9,1e9)
FLOAT_CUBE.Velocity = area.CFrame.LookVector * 120
1 Like