I was wanting to make a Zoo game and I wanted to make the animals feel more alive by making them move around their pen. But I couldn't figure out how I would move multiple parts at the same time. Like a chicken, with lots of different parts and each part moves at the same time, but its not a mesh. Please help me out!
Ok first up, model all the parts involved, while you can't move models since they don't have a Position value, they do have a PrimaryPart value, So set this PrimaryPart to any part of the animal, although it may be best to choose the main body of the animal. Now that your model has a root part you can move it just like any other part, you'd target it like this
local chicken = script.Parent.PrimaryPart
Of course if your movement script isn't in the model you'll have to change this, but as long as the script is placed in the model it'll work just fine
There are multiple ways to make different parts move. One of the best ways is using a WeldConstraint. There are multiple plugins where all you have to do is select multiple parts and press a button and you can weld them. Welding puts all the parts together while making them unanchored. If you move one part inside the chicken or cow and they are welded together, the entire chicken or cow will move. I can show you this on Roblox so shoot me a friend request @TheLastHabanero. You can also union all of the parts together. Unioning is not recommended because you can only union objects of the same color.
I hope this helps you!
Best
TheLastHabanero
Weld together a model by calling this function:
function weldModel(model) --the model needs a primary part to weld all the welds to, --if we don't specify a primary part, then this if statement will warn us in the console. if not model.PrimaryPart then warn("Please specify a primary part for the model ".. model.Name) end --go through each of the items in the model, for _, desc in pairs(model:GetDescendants())do --if the item we're looking at is a part or union, --weld that part/union to the model's primary part if desc:IsA("BasePart") or desc:IsA("UnionOperation") then local weldConstraint = Instance.new("WeldConstraint") weldConstraint.Parent = desc weldConstraint.Part0 = desc weldConstraint.Part1 = model.PrimaryPart desc.Anchored = false end end end weldModel(some model)