So in my game i have soldiers and i need to spawn them at different points in my game but those points arent really defined points as in random sorta thing i guess so is there a way to move my soldier possibly without his welds breaking when i spawn him?
local function weld(model, base) for i, v in pairs(model:GetChildren()) do if v:IsA("BasePart") or v:IsA("Union") and v.Name ~= base.Name then local w = Instance.new("Weld", game.JointsService) w.C1 = v.CFrame:toObjectSpace(base.CFrame) w.Part0 = base w.Part1 = v v.Anchored = false elseif v:IsA('Model') then weld(v, base) end end base.Anchored = false end local function handleUnit(player, building, unit) if debounce == 0 then debounce = 1 if unit == 'Soldier' then local offsets = {} for z, x in pairs(game.ServerStorage.Soldier:GetChildren()) do if x:IsA("BasePart") or x:IsA("Union") and x.Name ~= 'Torso' then offsets[z] = x.Position - game.ServerStorage.Soldier.Torso.Position end end local dummy = game.ServerStorage.Soldier:Clone() dummy.Torso.Position = building.rally.Position + Vector3.new(0, 1, 0) for z, x in pairs(dummy:GetChildren()) do if x:IsA("BasePart") or x:IsA("Union") and x.Name ~= 'Torso' then x.Position = dummy.Torso.Position + offsets[z] end end local new = dummy:Clone() new.Parent = game.Workspace new.Torso.BrickColor = colors[building.team.Value] weld(new, new.Torso) wait() new.Humanoid:MoveTo(new.Torso.Position + Vector3.new(10, 0, 0)) game:GetService('Debris'):AddItem(dummy, 3) end debounce = 0 else wait() handleUnit(player, building, unit) end end