Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I dont know how to make it separately ? :( (Help)

Asked by 8 years ago

I want the part to spawn every 0.1 sec with transparency animation, but this code is doing individually, meaning 1 by 1.

Code:

group = Instance.new("Model", game.Workspace)
group.Name = "fountain"

function tran(part)
    for i=0, 1, 0.1 do
        wait(0.5)
        part.Transparency = i
    end
end

while wait(0.1) do
    local part = Instance.new("Part", game.Workspace.fountain)
    part.Name = "Color"
    part.Position = Vector3.new(0, 10, 0)
    part.BrickColor = BrickColor.Random()
    part.Parent = game.Workspace.fountain
    tran(part)
end

2 answers

Log in to vote
0
Answered by 8 years ago

found the answer

group = Instance.new("Model", game.Workspace)
group.Name = "fountain"

function tran(part)
    for i=0, 1, 0.1 do
        wait(0.5)
        part.Transparency = i
    end
end

while wait(0.1) do
    local part = Instance.new("Part", game.Workspace.fountain)
    part.Name = "Color"
    part.Position = Vector3.new(0, 10, 0)
    part.BrickColor = BrickColor.Random()
    part.Parent = game.Workspace.fountain
    coroutine.resume(coroutine.create(tran), part)

end
Ad
Log in to vote
-1
Answered by 8 years ago

Split up the code for the Transparency then the code for spawning a block; every time it spawns the block put the transparency script inside of it. Sorry about whoever thumbs down you. This is a good legitimate post, please don't be discouraged.

Answer this question