Hey all. I’m trying to get a part to clone from serverstorage over to workspace which is working… but the only problem is that the children of the part don’t clone over properly as well as I want them to.
Basically I have a main part called HitBox and then I have a child named Coin. But when I clone over Hitbox, coin doesn’t clone over. Wouldn’t the child of the parent clone over the same as the parent? Maybe I have it wrong but here you go.
-- Services
local serverStorage = game:GetService("ServerStorage")
-- Variables
local spawnPart = game.Workspace.SpawnPart
local positionX = 50
local positionZ = 50
local height = 5
-- Main
for spawner = 0, 25, 1 do
print("This has been cloned")
local newFolder = serverStorage.CoinFolder.HitBox:Clone()
newFolder.Position = spawnPart.Position + Vector3.new(math.random(-positionX, positionX), height, math.random(-positionZ, positionZ))
newFolder.Parent = workspace
end
Could you provide a screenshot of how you have your folder/model set up?
If you have a Part inside another Part, changing the position of the parent won’t change the child.
You can just use a Model, contain both the hitbox and the coin inside of the model, make the PrimaryPart the hitbox, and call PivotTo() to change its position.
PivotTo() doesn’t necessarily need a PrimaryPart to function, which is an advantage over the deprecated method SetPrimaryPartCFrame(). If you are to use this method, make sure your model’s pivots are aligned properly (use Studio’s pivot editor), otherwise you may get strange placements.