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

parts from a group not fading in?

Asked by 3 years ago

i feel like its really obvious. sorry

-- ignore this part, not the problem
local green = Color3.fromRGB(55, 175, 97)
local ts = game:GetService("TweenService")
local tweenOg = ts:Create(script.Parent,TweenInfo.new(1),{Color = green})
local debounce = false
local flowers = script.Parent.Parent:FindFirstChild("Flowers")
local function size(part)
    local info = TweenInfo.new(1,Enum.EasingStyle.Quint,Enum.EasingDirection.Out)
    local partProperties = {
        Size = Vector3.new(21.884, 1.71, 23.563),
        Transparency = 1
    }
    local tween = ts:Create(part,info,partProperties)
    tween:Play()
end
-- ignore this part, not the problem

-- fade function
local function fade(part)
    for i = 1,0,0.1 do
        part.Transparency = i
        wait()
    end
end
-- fade function


script.Parent.Touched:Connect(function(limb)
    local hum = limb.Parent:FindFirstChild("Humanoid")
    if hum and not debounce then
        debounce = true
        script.Parent.Material = Enum.Material.Grass
        local clone = script.Parent:Clone()
        clone.Parent = script.Parent.Parent
        clone:ClearAllChildren()
        clone.CanCollide = false
        clone.Name = "clone"
        tweenOg:Play()
        size(clone)
        script.Parent.Material = Enum.Material.Grass
        -- it's a model and i want every part in that model to fade in, thus i used "for i,v in pairs"
        for i,v in pairs(flowers:GetChildren()) do
            fade(v)
        end
        wait(3)
        clone:Destroy()
        script:Destroy()
    end
end)

can't tell if im doing something wrong cuz im really lost lol..

0
i havent scripted in a while so yeah Omq_ItzJasmin 666 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

You forgot to make the increment value [0.1] a negative. It wouldn't make sense to increment by 0.1 to get an end value of 0. A positive increment value will count up and a negative increment value will count down. You can read more here: Loops

for i = 1,0,-0.1 do
    part.Transparency = i
    wait()
end

Don't feel ashamed, though; people can make mistakes.

0
BRUH I TOTALLY FORGOT ABOUT THAT. THANK UUUUUUUU Omq_ItzJasmin 666 — 3y
1
It seems as this answer helped answer your question. Marking as accepted. greatneil80 2647 — 3y
Ad

Answer this question