Move all of these models' part

Hi, this is a script that control’s a part in this model

tweenService = game:GetService("TweenService")
part = workspace.BloomJet.BloomJetModel.PrimaryPart
info = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false
)
posUp = part.CFrame + Vector3.new(0, .4, 0)
posDown = part.CFrame
moveUp = tweenService:Create(part, info, {CFrame = posUp})
moveDown = tweenService:Create(part, info, {CFrame = posDown})

script.Parent.MouseButton1Down:Connect(function()
	moveUp:Play()
end)

script.Parent.MouseButton2Down:Connect(function()
	moveDown:Play()
end)

because there’s more than one model in this case, the
part = workspace.BloomJet.BloomJetModel.PrimaryPart
doesn’t work.

the new directories are shown like the picture
image

inside each of the “Bloom##”

dflctrmtr’s location:
image

i tried using for i, v in pairs, doesn’t work

2 Likes

I don’t really understand what’s your intentions here. let me get you right, you want to move all of these childrens in the BloomJects folder together, all at once?

Also, if you don’t mind sharing the script, it will help me and others help you achieve what you seek for

1 Like

we’re trying to move the dflctrmtr part of each BloomJetModel with TweenService, and to do this we need to make a variable containing all of these dflctrmtr parts, where we’re having trouble is for getting all of those dflctrmtr parts inside one variable, also i think that for i,v in pairs doesn’t work in this case

1 Like

no, absolutely not, for i,v in pairs may works the best for this cases, it’s just because you didn’t know how to properly use it and i don’t blame you for it.

tweenService = game:GetService("TweenService")
part = workspace.BloomJet.BloomJetModel.PrimaryPart
info = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false
)

script.Parent.MouseButton1Down:Connect(function()
	for i, dflctrmtr in pairs(BloomJet:GetDescendants()) do
		if dflctrmtr.Name == "dflctrmtr" and dflctrmtr:IsA("Part") then

		posUp = dflctrmtr.CFrame + Vector3.new(0, .4, 0)
		moveUp = tweenService:Create(dflctrmtr, info, {CFrame = posUp})

 		moveUp:Play()
		end
	end
end)

script.Parent.MouseButton2Down:Connect(function()
	for i, dflctrmtr in pairs(BloomJet:GetDescendants()) do
		if dflctrmtr.Name == "dflctrmtr" and dflctrmtr:IsA("Part") then

		posDown = dflctrmtr.CFrame
		moveDown = tweenService:Create(dflctrmtr, info, {CFrame = posDown})

		moveDown:Play()
	end
end)

Also, this is entirely written on devforum, i didn’t use roblox studio to check for errors/typo within the script

1 Like

oh, i didn’t know that’s a thing, i’ll go try it out

it works! did have to make some minor adjustments but after that, it works perfectly.
thanks for your help!

1 Like

hmmm, i just noticed a problem


the part can still move down even after it’s reached its limit and can also still move up even after it’s fully raised

Sorry for a late reply but you can fix these problems by adding a limit for be raise and low event