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

How to tween children of a part?

I am trying to make a part and its children to expand in size when the remote event is fired. When I tweened the parent it wouldnt tween the children so I tried to use a looped search to get the children of the part but it only tweens 1 part. Do I need to individually tween each part?

Code:

local remote = game.ReplicatedStorage.HeavyPunch
local DB = false

remote.OnServerEvent:Connect(function(Plr)
	
	local PlrDB = {}
	
	local Char = Plr.Character
	local Hum = Char:WaitForChild("Humanoid")
	local HumRoot = Char.HumanoidRootPart
	
	local partloc = game.ServerStorage.Classes.UnArmed.HeavyPart
	local Punch = partloc:Clone()
	
	Punch.Parent = workspace
	
	Punch.CFrame = HumRoot.CFrame + HumRoot.CFrame.LookVector*1
	Punch.HeavySound:Play()
	
	for i, v in pairs(Punch:GetChildren()) do
		
		local TS = game:GetService("TweenService")
		local Info = TweenInfo.new(
			0.5,
			Enum.EasingStyle.Quad,
			Enum.EasingDirection.Out,
			0,
			false,
			0
		)
		
		local Goals = {
			Size = Punch.Size*5
		}
		
	local TweenMain = TS:Create(Punch, Info, Goals)
	
	TweenMain:Play()
		
		end
	
end)

1 answer

On line 36, replace Punch with v because v are all the different children of Punch which is what your trying to tween.

local TweenMain = TS:Create(v, Info, Goals)

2 comments

0

Yeah I already tried this. As I said in the question it only tweens 1 child of the parent not all of them.

0

v should have Tween each of the parts. Im not sure what is wrong if this doesn't work

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