Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

parts from a group not fading in?

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..

1 comment

0

i havent scripted in a while so yeah

1 answer

✓ Accepted answer

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.

2 comments

0

BRUH I TOTALLY FORGOT ABOUT THAT. THANK UUUUUUUU

1

It seems as this answer helped answer your question. Marking as accepted.

This discussion is preserved as it was. New answers, comments, and votes are closed.