How can I get these to follow the primary part which it's welded to?

Hey, so I’m a little bit rusty and I was wondering how I Can make it so when I adjust one parts position in a script all the other parts move adjacent with it.
image
So the wheat will spawn in underneath the dirt but when I try this the parts welded to the middle one won’t move with it. If i drag them around when I press run they stay in same place compared to it but when I adjust it in a script it won’t stay in same area.
image
All the other wheat should be on it’s side and adjusted position but they wont follow. It is welded together and the middle is anchored while the rest is unanchored. Any help would be appreciated.

local ServerStorage = game:GetService("ServerStorage")
local TweenService = game:GetService("TweenService")

local DirtFolder = game.Workspace.Dirt
local WheatClone = ServerStorage.Wheat

local function grow(dirt)
	if dirt.HasWheat.Value == false then 
		local wheat = WheatClone:Clone()
		wheat.Parent = dirt
		task.wait()
		wheat.Middle.Position = dirt.Position + Vector3.new(0, 0, 3)
		wheat.Middle.Orientation = dirt.Orientation
	end
end

grow(DirtFolder.Dirt)
3 Likes

When you Tween an Anchored Part any of the Parts that move with it are supposed to be Unanchored and Welded to the Tweened Part.

that’s exactly what they are but I haven’t tweened it yet

possibly make the weld in the game instead of during? or atleast change the Part1?

A video would show better what you mean.

Are you trying to move it with the tools in Studio? You’d have to select the model of the grain to move it, not just the single grain.

From the pictures I can see all the Parts upright in the first picture and the second shows what looks like the center Part laying beside the others. Your description doesn’t mention anything about rotating it. Are you sure it’s not unanchored and has just fallen over and laid there?

yeah look inside the script it moves as intended just other parts dont follow

1 Like

Because you aren’t tweening it.
You are CFraming just one Part and welds don’t follow when you do it that way. That’s what tweening does.

1 Like

so if I tweened it but made the tween 0 seconds long would that work?

So what you are saying is you don’t want a smooth movement, you just want the grain to snap to the position.
Why not make it a Model with the center Part as the PrimaryPart and use Model.TranslateBy or Model.PivotTo?

1 Like

I’ve never heard of these before thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.